image-processingwatermark

How to automate adding a watermark to a large amount of images


Is there a way I can automate adding a watermark to 1000+ images? I want to overlay some transparent text across each image. Can this be done using command line or some code?

Is it possible to go one step further and add a logo watermark?

I have IrfanView, but am open to doing this via another tool if necessary.


Solution

  • I recommend using ImageMagick, which is open source and quite standard for manipulating images on the command line.

    Watermarking with an image is as simple as

    composite -dissolve 30% -gravity south watermark.jpg input-file.jpg output-file.jpg
    

    With text, it's a little more complicated, but still possible.

    Using the above command as an example, a Bash command for doing this to all files in folder would be:

    for pic in *.jpg; do
        composite -dissolve 30% -gravity south watermark.jpg $pic ${pic//.jpg}-marked.jpg
    done
    

    For more information about watermarking with ImageMagick, see ImageMagick v6 Examples.