Damar TD
Damar TD

Reputation: 15

Image magick - Merge a picture over all pictures in the folder (watermark)

  1. I have a picture in PNG format, watermark.png (300x300 pixel) (transparency)
  2. I have many pictures in JPG format, in a folder 1.jpg, 2.jpg, etc (300x300 pixel)

How to merge them,

watermark.png above the 1.jpg
watermark.png above the 2.jpg
watermark.png above the picture in folder

how can achieve this ?

Upvotes: 1

Views: 538

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 207345

Normally, when you want to apply the same process to lots of images, you use ImageMagick mogrify command, but that is a bit difficult because you need a way to separate all the background images from the name of the watermark image that you want to use with a -composite command.

One neat trick, is to use the -draw command like this:

magick mogrify -draw "image SrcOver 0,0 0,0 watermark.png" *.jpg

If you want to test it before potentially wrecking all your images by overwriting in the wrong place, one way is to add -format GIF and all the output files will be GIF files and won't overwrite the input files.

Another option is to run:

mkdir result
magick mogrify -path result ... as above ...

and the output images will appear in the result directory without overwriting the originals.

enter image description here

Upvotes: 2

Related Questions