Snippets - Text
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.
Fonts Installed view - Anthony 15/6/2008
This shows all the installed fonts with the name written using the actual font. There were acouple of problems with this example. 1/ The ' had been missed out in the preg_match and 2/ I have found that the array generated with font and type are different. I tested it with a version below 6.3.5 and it worked but would not work in versions above that. I have modifeid the code to work with both versions but it will need to be tidied up.
<?phpsystem("convert -version");// Select the version number from the configeration filepreg_match('/^LIB_VERSION_NUMBER ([0-9,]+)$/m', shell_exec("convert -list configure "), $vnums);// Seperate the numbers at the ,$number = explode( ",", $vnums[1] );// Format the version from 6,3,4,1 format to 06030401$version = "";for($i=0;$i<4;$i++){$version .= str_pad( $number[$i], 2, '0', STR_PAD_LEFT );}// The 'list' method used to get the fonts changed in IM v6.3.5-7$font_list = ( $version > "06030507" ) ? "font" : "type";// Populate the array only - do not display itexec("convert -list $font_list", $IMarray, $code);// Sort the array alphabeticlysort( $IMarray );// Setup some default values$delete = array();$image_list = "";// Function to remove items from arrayfunction array_delete( $array, $filterfor ){$thisarray = array ();foreach( $array as $value )if( stristr( $value, $filterfor )===false && strlen( $value )>0)$thisarray[] = $value;return $thisarray;}// Remove items containing Name from the arrary$NoName = array_delete( $IMarray, "Name" );// Remove items containing Path: from the array$NoPath = array_delete( $NoName, "Path:" );// Remove items containing Path: from the array$NoFamily = array_delete( $NoPath, "family:" );// Remove items containing Path: from the array$NoStretch = array_delete( $NoFamily, "stretch:" );// Remove items containing Path: from the array$NoWeight = array_delete( $NoStretch, "weight:" );// Remove items containing Path: from the array$NoStyle = array_delete( $NoWeight, "style:" );// Find the amount of items in the array$count = count( $NoStyle );// Reduce the count by one as the array starts at 0$count = $count-1;// Start the loop to generate the imagesfor ( $i=2; $i<=$count; $i++ ) {// Get the font name from the array$FirstPart = explode(':', $NoStyle[$i]);$Font = str_replace( ' ', '', $FirstPart['1']);$Image = $Font.".png";// Create the images$cmd = "-size 250x15 xc:lightblue -font $Font -pointsize 13 -draw \"gravity West fill black text 0,0 $Font \" ";// echo $cmd."<br>";exec("convert $cmd $Image");// Generate the list of images for use in the large image$image_list = $image_list." ".$Image;// Generate the array of tempory images to delete$delete[] = $Image;}// Create the large imageexec("convert -background white -gravity Center $image_list -append fonts.png");// Delete the tempory imagesforeach ( $delete as $value ) {unlink( $value ); }?><img src="fonts.png">

For more examples and information check out the main Imagemagick section.
Add a label ViewChange font to Italic View
Fonts installed View
Fonts Installed view View
Label with image data View
Multiple text on an image View
Text made from an image on another image View
Watermark text and shadow View
Watermark tiled text View