php - Add space between each word in multi-colored text image -
i trying produce multi-colored text image imagemagick , php. following code works, cannot insert space after each word. have tried various settings, nothing working. should use annotate or draw text command instead of label? label seems simple use here.
$file = 'font.ttf'; $command = "convert -background white -fill black -font $file -pointsize 80 -density 90 label:new -fill black -font $file -pointsize 80 -density 90 label:here -fill red -font $file -pointsize 80 -density 90 label:? +append $multi-color-text.png"; exec($command);
update: solution
remarks: spaces not work in command line. so, need escape double quotes forward slash.
this has worked:
$command = "convert -background white -fill black -font $file -pointsize 80 -density 90 label:\"new \" -fill black -font $file -pointsize 80 -density 90 label:\"here \" -fill red -font $file -pointsize 80 -density 90 label:? +append $multi-color-text.png";
thank all, fred!
in case seems better use -annotate
once want insert multiple texts instead of using -label
.
example of use of -annotate
: http://www.imagemagick.org/usage/annotating/#gravity_text
Comments
Post a Comment