Skip to content

retzion/node-image-watermark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-image-watermark

npm version Issues Forks Stars License: GPL v2

See the demo (view source)

Using the moodule

  1. Install GraphicsMagick on your machine (or a buildpack on your server)
  2. Install the NPM module
    npm i node-image-watermark
  3. Import the module
const watermark = require("node-image-watermark")
  1. Set your params according to your requirements:
app.get("/img/:imageUrl", (req, res) => {
  const { imageUrl } = req.params
  if (!imageUrl) res.sendStatus(404)

  res.set("Content-Type", "image/png")
  watermark({
    geometry: "45,45",
    resize: "1600,900",
    watermarkPath: "./watermark.png",
  }).pipe(res)
})



Params:

Pass geometry, resize, and watermarkPath as options properties in order to customize the image.

  • resize: String representation of a tuple of X, Y dimensions for resizing the base image (ex: "800,450")

  • geometry: String representation of a tuple of X, Y coordinates for where to place the watermark (ex: "30,30")

  • watermarkPath: Local path to a watermark image file (ex: ./watermark.png)




resources:

Heroku Buildpack: https://elements.heroku.com/buildpacks/xerpa/heroku-buildpack-graphicsmagick

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published