0.1.3 • Published 3 years ago

node-image-watermark v0.1.3

Weekly downloads
11
License
GPL-2.0
Repository
github
Last release
3 years ago

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 modulenpm 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

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago