Snippets - Create
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.
Draw rectangle - 17/6/2008
Creates a transparent background 200x185 then draws the rectangles.
<?php$cmd = " -size 200x185 xc:none "."-fill grey39 -draw \"rectangle 47,0 102,20\" "."-fill grey39 -draw \"rectangle 157,0 176,185\" "."-fill red -draw \"rectangle 0,16 200,73\" "."-fill silver -draw \"rectangle 10,36 167,145\" "."-fill blue -draw \"rectangle 130,0 150,185\" "."-fill brown -draw \"rectangle 72,110 200,137\" "."-fill grey26 -draw \"rectangle 0,99 56,185\" "."-fill grey39 -draw \"rectangle 81,102 120,185\" "."-fill green -draw \"rectangle 30,164 200,177\" ";exec("convert $cmd output.png");?>

For more examples and information check out the main Imagemagick section.
Draw concentric circles ViewDraw polyline View
Draw rectangle View
Draw using ellipse View