Home arrow Journal arrow Add a Watermark to Images with ImageMagick
Add a Watermark to Images with ImageMagick PDF
Tuesday, 07 June 2011
We can easily add a watermark to a directory of images with ImageMagick in FreeBSD.

To do that we will create first an PNG transparent image with our watermark.

Then we install ImageMagick:

  cd /usr/ports/graphics/ImageMagick

We can add a watermark to an image with the following line:

  composite -gravity Center watermark.png source_image.png destination_image.png

To apply watermark to all images from a folder we will create a script.
We place the following script and the watermark image (our transparent PNG file) in the directory where images are:

watermark.sh
!/bin/sh

# position, Center, SouthEast, SothWest, NorthEast, NorthWest
pos="Center"

files=`ls *png`
mkdir wmarked

for i in $files
do
  echo "Processing: "$i
  composite -gravity $pos watermark.png $i wmarked/$i
done

 
< Prev   Next >

Other BSD Systems

OpenBSD

Misc

Solaris

Polls

Best BSD firewall?