Page 1 of 1

How to wrap this text automatically using 'text'

Posted: 2009-01-05T05:39:09-07:00
by donnied
I am trying to create image files for various text. I would like it to auto wrap and it seems that I'll need to use caption and specify the size with only one dimension (1000x). Can I word wrap automatically using the text option?

Typically I would do:

Code: Select all

for ((i=1; i<=185; i++));do export b=${fsf3:0:$i};echo $b; convert -size 2000x500 xc:transparent -family Essays1743  -pointsize 42 -draw "text 65,100 '$b'" -channel RGBA -gaussian 0x6 -fill dodgerblue1 -stroke slategray4  -draw "text 50,100 '$b'" freedom3$i.png; done 
but I want to try to get the text to auto wrap so I tried using just one dimension but that created empty files:

Code: Select all

 for ((i=1; i<=185; i++));do export b=${fsf3:0:$i};echo $b; convert -size 1000x xc:transparent -family Essays1743  -pointsize 42 -draw "text 65,100 '$b'" -channel RGBA -gaussian 0x6 -fill dodgerblue1 -stroke slategray4  -draw "text 50,100 '$b'" free3$i.png; done 
?

If not I guess I'll have to go with 'caption' or 'label' which will be fine but I do like the shadow effect.

I also noticed that when I string the files together as an animated gif they run slow (e.g. -delay 0 produces a gif that moves at about the same speed as -delay 20).

Re: How to wrap this text automatically using 'text'

Posted: 2009-01-06T18:58:05-07:00
by anthony
Only caption has word wrapping.

If you want to do it a different way then you will have to write a program to do it that way. sorry.

See IM Examples, Text to Image Handling, Caption for more info
http://www.imagemagick.org/Usage/text/#caption

NOTE: if you do not specify a pointsize IM will try to fit the largest text it can into the space (both width and height) specified.

Re: How to wrap this text automatically using 'text'

Posted: 2009-01-10T13:38:49-07:00
by donnied
I decided to go with:

Code: Select all

for ((i=1; i<=64; i++));do export a=${intro:0:$i};echo $a; echo $a| convert -size 1024x -font Essays1743-BoldItalic  -pointsize 42  -channel RGBA -background transparent -fill dodgerblue1 -stroke slategray4 caption:@- intro$i.png; done
Thank you.