Snippets - Watermark

Snippets index page

NOTE: Most of the IM snippets have been tested on IM version 6.3.5 There may be some differences if you are using the code on other versions.

Watermark text and shadow - Anthony 16/6/2008

Adding text to an image with a "shadow"; annotate works better than draw.

  1. <?php  
  2. $cmd "input.jpg -font ../verdana.ttf -pointsize 30 ".
  3. " -gravity north -fill black ".
  4. " -annotate +0+12 \"Copyright of rubblewebs\" ".
  5. " -gravity north -fill white ".
  6. " -annotate +2+11 \"Copyright of rubblewebs\"  ";
  7. exec("convert $cmd output.png"); 
  8. ?> 

For more examples and information check out the main Imagemagick section.

Image watermark View

Multiple image watermarks View

Rotated transparent text View

Transparent text View

Watermark an animated gif View

Watermark text and shadow View

Watermark tiled text View