Batch Watermark Images Using ImageMagick
In my previous post, I talked about using ImageMagick to resize images in a batch process. In this post, I’ll talk about leaving watermarks on images in a batch process. First of all, what is a watermark? A watermark is an image or text that appears on paper or photographs to prevent counterfeiting or for giving a photographer credit or ownership. It’s one way of getting recognition when distributing one’s artwork.
Let’s say you have a bunch of images about 30 or so needing a watermark. They all have an extension of JPG located in one directory or folder. First, if you haven’t already done so, install ImageMagick by typing in the Terminal, “sudo apt-get intall imagemagick.” Once you have ImageMagick installed, change directory to the folder where your images are located.
We will use the convert command to leave a text watermark at the bottom of each image. I will go over each of the options one by one. We will put all the options together in the end.
Convert all images with a JPG extension
convert *.JPG
Use the Arial font
convert *.JPG -font Arial
Use a fontsize of 16
convert *.JPG -font Arial -pointsize 16
Place the watermark at the bottom center of each image
convert *.JPG -font Arial -pointsize 16 -draw gravity south
You can place your watermark text anywhere you want it, for example at the top of the image, the side or at the corner. I placed it in the bottom center. It’s just a personal preference.
Write a black text at position 0,12 supplied inside a single quote.
convert *.JPG -font Arial -pointsize 16 -draw "gravity south
fill black text 0,12 'Photos by: Ulysses'"
By the way, the command is all on one line. I placed it on several lines for readability.
Write a white text at position 1,11 supplied inside a single quote.
convert *.JPG -font Arial -pointsize 16 -draw "gravity south
fill black text 0,12 'Photos by: Ulysses'
fill white text 1,11 'Photos by: Ulysses'"
The reason we are writing black and white text that are slightly offset is for our watermark text to display regardless of background color. It’s a technique similar to creating a drop shadow. This ensures your watermark text is readable regardless of the color of the background image.
Finally, name the watermarked images in this format.
convert *.JPG -font Arial -pointsize 16 -draw "gravity south
fill black text 0,12 'Photos by: Ulysses'
fill white text 1,11 'Photos by: Ulysses'"
watermark.JPG
The watermarked images will be written as watermark-0.JPG, watermark-1.JPG, watermark-2.JPG and so forth. So, there you have it. You just watermarked 30 or so images in a batch process using ImageMagick.
