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. | |||||||||||||||
| |||||||||||||||
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"); ?> |
90x90 | 0x180 | 180x0 | 270x270 | 90x270 |
ALL FILES ZIPS | |
ARBOR SERVER | OTHER SERVERS |
TEXT FILES | |
Label.txt | |
Annotate Image txt | |
Gradient txt |