How to Add Text Watermark to Image with ImageMagick?

This article provides a straightforward guide on how to protect or brand your images by overlaying a text watermark using the ImageMagick convert command. You will learn the basic command structure, how to customize text properties like font, size, and opacity, and how to precisely position your watermark using gravity settings.

The Basic Watermark Command

To add a simple text watermark to an image, you can use the -draw operator within the ImageMagick convert command. This method allows you to specify the text, its color, and its position directly in a single line of code.

convert input.jpg -pointsize 36 -fill white -gravity center -draw "text 0,0 'Copyright 2026'" output.jpg

Customizing Your Watermark

To make your watermark look professional, you will likely want to adjust its appearance so it doesn’t completely obscure the underlying image.

Here is a more advanced example utilizing transparency and custom positioning:

convert input.jpg -font Arial -pointsize 40 -fill "rgba(255,255,255,0.4)" -gravity SouthEast -geometry +20+20 -draw "text 0,0 'My Brand'" output.jpg

Command Breakdowns

Parameter Description Example
-font Specifies the text font style -font Helvetica
-pointsize Sets the font size in points -pointsize 48
-fill Sets the text color and opacity level -fill "rgba(0,0,0,0.5)"
-gravity Sets the reference point on the image -gravity SouthWest
-geometry Offsets the text from the gravity point (X,Y) -geometry +50+50
-draw Executes the text rendering command -draw "text 0,0 'Sample'"

Batch Processing Multiple Images

If you have an entire folder of images that need the same watermark, you can combine the ImageMagick logic with a simple shell loop to process them all at once.

for img in *.jpg; do
  convert "$img" -pointsize 30 -fill "rgba(255,255,255,0.5)" -gravity Center -draw "text 0,0 'DO NOT COPY'" "watermarked_$img"
done

Using these configurations ensures your digital assets remain identifiable while maintaining a clean, automated workflow.