Multiline text image using -draw
Posted: 2017-03-23T10:58:58-07:00
Linux, ImageMagick 6.5.4-7 2012-05-07 Q16 OpenMP
Trying to watermark images and allow multiline text to be used. The user can define there own string. I'm building an image of the text and then compositing it over the image to be water marked. The text image is multi shaded so it is visible on any background.
I'm using the -draw text primitive to build the text image(stamp.png). I initially used -annotate which allows me to use the \n newline for multiline but the results were not as good as the -draw text allows. My text is stored in the variable STEXT.
How can I pass in a newline character to -draw text?
thanks, scott
Trying to watermark images and allow multiline text to be used. The user can define there own string. I'm building an image of the text and then compositing it over the image to be water marked. The text image is multi shaded so it is visible on any background.
I'm using the -draw text primitive to build the text image(stamp.png). I initially used -annotate which allows me to use the \n newline for multiline but the results were not as good as the -draw text allows. My text is stored in the variable STEXT.
How can I pass in a newline character to -draw text?
Code: Select all
convert -size $markSize xc:grey30 -font $FONT -pointsize $POINT -gravity center \
-draw "fill grey text 0,0 '$STEXT'" \
stamp_fgnd.png
convert -size $markSize xc:black -font $FONT -pointsize $POINT -gravity center \
-draw "fill grey text 1,1 '$STEXT' \
text 0,0 '$STEXT' \
fill black text -1,-1 '$STEXT'" \
+matte stamp_mask.png
composite -compose CopyOpacity stamp_mask.png stamp_fgnd.png stamp.png
mogrify -trim +repage stamp.png
composite -gravity $WHERE -geometry +0+10 stamp.png $FILE $FILE.jpg