Continuing my series on working with ImageMagic here is an example on how to annotate an image with text and using fonts already on the server. There are so many ImageMagick annotate options that I can’t list them all here!
Annotate and image with ImageMagic and PHP

Original test image
Simple annotate
How its done
Here is the code used for the above image annotation.
[php]
<?php
header( ‘Content-Type: image/jpg’ );
system("convert saob.jpg -font AvantGarde-Book -fill black -pointsize 20 -gravity center -annotate +0+0 ‘Senseless Acts of Beauty’ jpg:-");
?>
[/php]
Code Breakdown
- saob.jpg (The location of the original test image)
- -font AvantGarde-Book (The font command sets the font family, I chose AvantGarde-Book which is already used by my server)
- -fill black (fill is the command that sets the fill for the font, I set the color to black)
- -pointsize 20 (set the size of the font to 20)
- -gravity center (tells the font to be placed in absolute center of the image, vertically and horizontally)
- -annotate +0+0 ‘Senseless Acts of Beauty’ (command to apply text to image, you can use the +0+0 as x and y coordinates)
- jpg:- (output a jpg file)
See reference and tons of example here.