Hello everyone,
with php I create this command for image composition that works. But I want to render the text in a box area of a width of 100px (es.).
Does anyone know tell me the parameters to give the text?
if I use-size parameter again for text area doesn't work
convert -size "500"x"500" xc:white -density "72"x"72" -units PixelsPerInch -draw "translate 0,0 image Over 0,0 425,425 "background.jpg"" -draw "translate 155,100 image Over 0,0 125,125 "image/sun.jpg"" -font "font_ttf/font_ttf/Helvetica.ttf" -pointsize "16" -fill "red" -draw "translate 130,240 text 0,0 'text i like wrap in a box area of 150px large!'" out.png
it is very urgent!
Tanks
how to render a long text in an area with automatic wrap
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: how to render a long text in an area with automatic wrap
"-draw text" doesn't word-wrap. "caption:" does. See http://www.imagemagick.org/Usage/text/
snibgo's IM pages: im.snibgo.com
Re: how to render a long text in an area with automatic wrap
Thanks,
how I have to specify the size of the box where render the text (es. 150 pixel large) ?
If I repeat -size parameter does'nt works.
Can you hlp me?
Thanks
how I have to specify the size of the box where render the text (es. 150 pixel large) ?
If I repeat -size parameter does'nt works.
Can you hlp me?
Thanks
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how to render a long text in an area with automatic wrap
try
Then composite this over your background image at the desired locations using -gravity and -geometry
See
http://www.imagemagick.org/Usage/text/#caption
http://www.imagemagick.org/Usage/layers/#convert
http://www.imagemagick.org/Usage/annotating/#gravity
http://www.imagemagick.org/script/comma ... p#geometry
http://www.imagemagick.org/script/comma ... hp#gravity
Code: Select all
convert -background none -size 150x -fill black -font yourfont -pointsize PP caption:"your text here" result.png
Code: Select all
convert backgroundimage result.png -gravity ZZ -geometry +X+Y -compose over -composite finalresultimage
http://www.imagemagick.org/Usage/text/#caption
http://www.imagemagick.org/Usage/layers/#convert
http://www.imagemagick.org/Usage/annotating/#gravity
http://www.imagemagick.org/script/comma ... p#geometry
http://www.imagemagick.org/script/comma ... hp#gravity
Re: how to render a long text in an area with automatic wrap
my I use -size parameter two time?
After your indication i have tried:
convert -size "500"x"500" xc:white -density "72"x"72" -units PixelsPerInch -draw "translate 0,0 image Over 0,0 425,425 "background.jpg"" -draw "translate 155,100 image Over 0,0 125,125 "image/sun.jpg"" -font "font_ttf/font_ttf/Helvetica.ttf" -pointsize "16" -fill "red" -draw "translate 130,240 -size 150x caption: 'text i like wrap in a box area of 150px large!'" out.png
but does'nt works.
After your indication i have tried:
convert -size "500"x"500" xc:white -density "72"x"72" -units PixelsPerInch -draw "translate 0,0 image Over 0,0 425,425 "background.jpg"" -draw "translate 155,100 image Over 0,0 125,125 "image/sun.jpg"" -font "font_ttf/font_ttf/Helvetica.ttf" -pointsize "16" -fill "red" -draw "translate 130,240 -size 150x caption: 'text i like wrap in a box area of 150px large!'" out.png
but does'nt works.
Re: how to render a long text in an area with automatic wrap
I am not surprised; I would work on one step at a time and when that works move onto the next - you have so many things going on it would be very hard to debug.but does'nt works.
You will also need to use parenthesis to group certain options.
It would be a good idea to link to an expected final output image so we know what you actually want.
Re: how to render a long text in an area with automatic wrap
But I start by a comand that works:
convert -size "500"x"500" xc:white -density "72"x"72" -units PixelsPerInch -draw "translate 0,0 image Over 0,0 425,425 "background.jpg"" -draw "translate 155,100 image Over 0,0 125,125 "image/sun.jpg"" -font "font_ttf/font_ttf/Helvetica.ttf" -pointsize "16" -fill "red" -draw "translate 130,240 text 0,0 'text i like wrap in a box area of 150px large!'" out.png
do you kow how insert caption parameter with -size in my comand?
(I have seen parenthesis link)
thanks
convert -size "500"x"500" xc:white -density "72"x"72" -units PixelsPerInch -draw "translate 0,0 image Over 0,0 425,425 "background.jpg"" -draw "translate 155,100 image Over 0,0 125,125 "image/sun.jpg"" -font "font_ttf/font_ttf/Helvetica.ttf" -pointsize "16" -fill "red" -draw "translate 130,240 text 0,0 'text i like wrap in a box area of 150px large!'" out.png
do you kow how insert caption parameter with -size in my comand?
(I have seen parenthesis link)
thanks
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how to render a long text in an area with automatic wrap
You need to learn to use parenthesis processing so that the arguments do not apply repeatedly to the wrong part of the code. Also break long commands into newlines using a trailing \ at the end of the section so that the code is readable. See http://www.imagemagick.org/Usage/basics/#parenthesis.
-draw does not word wrap. you need to use caption and -size=Wx (not -size=WxH). See http://www.imagemagick.org/Usage/text/
-draw does not word wrap. you need to use caption and -size=Wx (not -size=WxH). See http://www.imagemagick.org/Usage/text/
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: how to render a long text in an area with automatic wrap
The syntax is wrong. "caption:" is not a valid option for "-draw".artex wrote:-draw "translate 130,240 -size 150x caption: 'text i like wrap in a box area of 150px large!'"
snibgo's IM pages: im.snibgo.com