Automatic word wrapping
<?php
exec("convert -size 236x130 xc:lightblue -fill black -font ../fonts/verdana.ttf \\
-pointsize 25 -gravity NorthWest \\
-annotate +0+0 \"The quick red fox jumped over the lazy brown dog.\" annotate1.jpg");
?>
Forced word wrapping
<?php
exec("convert -size 236x130 xc:lightblue -fill black -font ../fonts/verdana.ttf \\
-pointsize 25 -gravity NorthWest \\
-annotate +0+0 \"The quick red fox\\njumped over\\nthe lazy brown\\ndog.\" annotate2.jpg");
?>
Normal line feeds - Using a normal end of line on the text inside the " "
<?php
exec("convert -size 236x130 xc:lightblue -fill black -font ../fonts/verdana.ttf \
-pointsize 25 -gravity NorthWest \
-annotate +0+0 \"The quick red fox
jumped over the
lazy brown dog.\" annotate3.jpg");
?>
Using NorthWest aligns the text left and NorthEast aligns the text right;
as well as locating the text on the background.
Automatic word wrapping
<?php
exec("convert -size 230x130 -background lightblue -font verdana.ttf -pointsize 25 \\
-gravity NorthWest caption:\"The quick red fox jumped over the lazy brown dog.\" \\
-flatten caption1.jpg");
?>
Forced word wrapping
<?php
exec("convert -size 230x130 -background lightblue -font verdana.ttf -pointsize 25 \\
-gravity NorthWest caption:\"The quick red fox\\njumped over\\nthe lazy brown dog.\" \\
-flatten caption2.jpg");
?>
Normal line feeds - Using a normal end of line on the text inside the " "
<?php
exec("convert -size 230x130 -background lightblue -font verdana.ttf -pointsize 25 \
-gravity NorthWest caption:\"The quick red fox
jumped over the
lazy brown dog.\" \
-flatten caption4.jpg");
?>
Select font to fit image size
<?php
exec("convert -size 230x130 -background lightblue -font verdana.ttf \\
-gravity NorthWest \\
caption:\"The quick red fox jumped over the lazy brown dog.\" -flatten caption3.jpg");
?>
Automatic word wrapping
<?php
exec("convert -size 230x130 xc:lightblue -font verdana.ttf -pointsize 25 \\
-draw \"gravity NorthWest fill black text 0,0 'The quick red fox jumped over the lazy brown dog.'\"\\
draw2.jpg");
?>
Forced word wrapping
<?php
exec("convert -size 230x130 xc:lightblue -font verdana.ttf -pointsize 25 \\
-draw \"gravity NorthWest fill black text 0,0 'The quick red fox\\njumped over\\nthe lazy brown dog.'\"\\
draw2.jpg");
?>
Normal line feeds - Using a normal end of line on the text inside the ' '
<?php
exec("convert -size 230x130 xc:lightblue -font ../fonts/verdana.ttf -pointsize 25\\
-draw \"gravity NorthWest fill black text 0,0 'The quick red fox
jumped over
the lazy brown dog.'\" draw3.jpg");
?>
<?php
exec("convert -background lightblue -fill black -font verdana.ttf -pointsize 25 \\
-size 230x caption:@text.txt caption_file.gif");
?>