How to Watermark Images Using ImageMagick (composite) on the Command Line
These instructions are for watermarking images on the command line using the ImageMagick command "composite". So you'll need to have SSH access to your images. (To watermark images off-server -- ie., on your desktop in Windows -- check out this list of programs.)
1. Create a PNG watermark image
Using PNG, you can avoid distortion of the watermark when its composited
If your original images are dark, you should use white text for the watermark. If your images are light, use black text. Don't worry about shades of the text color for now. You can adjust how brightness of the watermark on the command line.
I used Photoshop to create a small image with the watermark text, then save it as PNG.
2. Run the command: composite
The full command with options is:
composite \
-dissolve 80 \
-gravity southeast \
watermark.png \
original-image.jpg \
new-watermarked-image.jpg
This command applies the watermark image to the original image, and creates a new composite image. It sets the watermark to be 80% of its brightness, and places the watermark in the southeast corner (bottom right) of the image.
Notes for each element of the command:
- composite -- The ImageMagick command that combines two images.
- -dissolve 80 -- The number after the option determines the brightness of the watermark. 100 is full strength. I've found that 15-30 is good for black text on very light images -- makes for a kind-of embedded look. For white text on dark images, I tend to use 80-100 for maximum "pop" of the white text.
- -gravity southeast -- Determines where the watermark appears. Your options are north, west, south, east, northwest, northeast, ... etc.
- watermark.png -- The watermark image is the first argument.
- original-image.jpg -- The second argument is the original image to be watermarked.
- new-watermarked-image.jpg -- The third argument is the new composite image to be created. If you don't specify a new file, the original file will be overwritten.
Here's the full list of ImageMagick's command line options. You can also run "composite -h" to get a brief help summary.
Post new comment