Hi! I want to add a text label on an image and to apply arc distort on the label only. Also, I would like to set custom position of the label. So far I just managed to add an arc-distorted label in the image center without any way to control label's position:
convert -page +0+0 $in \( -size 640x360 -gravity center -background none \
-font font.ttf -fill 'red' -pointsize 24 \
label:"some text" -distort Arc '280 0' \) -flatten $out
Input image has dimensions 640x360. Do I have to create an image with the label first and then compose them, or there is a way to do it with one command? Thanks
Struggling with arc distortion on a text label
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Struggling with arc distortion on a text label
You are creating a separate image for the label and compositing it using -flatten. Add another -page before the parens creating the label to tell it where to place it. Or use -gravity -geometry with -composite rather than -flatten. One -page is needed for each image and must go before the image. -geometry goes after the image when used with -composite
convert -page +0+0 $in \
-page +X+Y \( -size 640x360 -gravity center -background none -font font.ttf \
-fill 'red' -pointsize 24 label:"some text" -distort Arc '280 0' \) \
-flatten $out
or
convert $in \
\( -size 640x360 -gravity center -background none -font font.ttf -fill 'red' \
-pointsize 24 label:"some text" -distort Arc '280 0' \) \
-geometry +X+Y -composite $out
see
http://www.imagemagick.org/Usage/layers/#flatten
http://www.imagemagick.org/Usage/layers/#convert
convert -page +0+0 $in \
-page +X+Y \( -size 640x360 -gravity center -background none -font font.ttf \
-fill 'red' -pointsize 24 label:"some text" -distort Arc '280 0' \) \
-flatten $out
or
convert $in \
\( -size 640x360 -gravity center -background none -font font.ttf -fill 'red' \
-pointsize 24 label:"some text" -distort Arc '280 0' \) \
-geometry +X+Y -composite $out
see
http://www.imagemagick.org/Usage/layers/#flatten
http://www.imagemagick.org/Usage/layers/#convert
Re: Struggling with arc distortion on a text label
I haven't succeed with the first method (maybe missed something dunno), but the second works fine. I was trying something similar but apparently did not find the correct order of parameters. Thanks a lot!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Struggling with arc distortion on a text label
Does this work?
convert -page +0+0 $in \
\( -page +X+Y -size 640x360 -gravity center -background none -font font.ttf \
-fill 'red' -pointsize 24 label:"some text" -distort Arc '280 0' \) \
-flatten $out
convert -page +0+0 $in \
\( -page +X+Y -size 640x360 -gravity center -background none -font font.ttf \
-fill 'red' -pointsize 24 label:"some text" -distort Arc '280 0' \) \
-flatten $out