ANNOTATE

This tutorial covers some of the functions available for using PHP with Image Magick from the command line to Annotate Labels and Images. For more information on PHP variables see Lesson I on making backgrounds.
IM COMMANDFUNCTION
-background lightblueColor for background
-fill blueColor for font
-font Arial.ttfFont to use from your directory.
-pointsize 30Point size of font.
"Label:'ImageMagick\nRules - OK!'"What to write. Note the single quotes around the phrase to write. The \n denotes a break line.
linebreak.gifname of your image

EXAMPLES

This script will make a background that is just large enough for the words written on it.
<?
$BACK="-background lightblue";
$FILL="-fill blue";
$FONT="-font Arial-Bold";
$POINT="-pointsize 30";
$LABEL="label:'ImageMagick\nRules - OK!'";
$OUT="linebreak.gif";
exec ("/usr/bin/convert $BACK $FILL $FONT $POINT $LABEL $OUT");
?>
This example uses an image with the annotate and gravity command added to the script, in place of the label. The 0x0 is for rotating the script while +0+0 is for the geometry as it pertains to the gravity. Note also that it uses a hex color which must be between single quotes for the server to recognize it.
<?
$BACK="angel.gif";
$FILL="-fill '#663300'";
$FONT="-font Disney.ttf";
$POINT="-pointsize 30";
$GRAVITY="-gravity north -annotate 0x0+0+0";
$LABEL="'MAGICK ANGEL'";
$OUT="gravity0.gif";
exec ("/usr/bin/convert $BACK $FILL $FONT $POINT $GRAVITY $LABEL $OUT");
?>
You can tile your fonts with a gradient color or an image by adding "-tile color-color" or "-tile image.jpg" to the commands. In this example a size is used for the background as well as an xc. Make it large enough for your label.Image used for Tile
<?
$SIZE="-size 480x280";
$XC="xc:transparent";
$FONT="-font Disney.ttf";
$POINT="-pointsize 80 -gravity center";
$TILE="-tile dots.jpg";
$ANNOTATE="-annotate 0x0+0+0";
$LABEL="'Image\nMagick'";
$OUT="temp/tileWord.gif";
exec ("/usr/bin/convert $SIZE $XC $FONT $POINT $TILE $ANNOTATE $LABEL $OUT");
?>
<?
$GSIZE="-size 300x80";
$GXC="transparent";
$GFONT="-font spacecowboy.ttf";
$GPOINT="-pointsize 60";
$GTILE="orange-navy";
$GANNOTATE="-gravity southwest -annotate 0x0+0+0";
$GLABEL="'MAGICK'";
$OUT="gradlab.gif";
exec ("/usr/bin/convert $GSIZE xc:$GXC $GFONT $GPOINT -tile gradient:$GTILE $GANNOTATE $GLABEL $OUT");
?>


Below are some examples of rotated text using a gravity of center.

90x900x180180x0270x27090x270
I have two versions of zips for download. One is for Arbor only as it contains Arbor's built in fonts, some of the fonts will work at z-box but not all. Other is for using ttf fonts within your own directory. It does not contain the built in fonts but there are a few fonts in the package that should be placed in the same directory as the scripts. You can also use any of your own fonts as well by adding them to either script in the same manner as the fonts already listed in the script.
ALL FILES ZIPS
ARBOR SERVEROTHER SERVERS
TEXT FILES
Label.txt
Annotate Image txt
Gradient txt

ALL IM TUTORIALS
LingoLinda.com