Page 1 of 1
word wrapping issue
Posted: 2008-10-28T03:55:03-07:00
by franco64
Hi and apologies for this stupid question but i just can not figure out why this is happening
I have the following script
convert -size 720x480 xc:transparent -stroke black -strokewidth 1 -fill lightblue -colorspace RGB -depth 10 -font Hiragino-Kaku-Gothic-ProN-W3 -gravity North -pointsize 38 -annotate +0+10 'かいけいぼは きょねん かんさされました。' -annotate +0+60 'kaikeiboha kyonen kansasaremashita。' /Users/franco/Desktop/Japanese/Banking/Phrase20.png
now i know if i reduce the pointsize to 32 it will work for most but i still have some that are just cropped at the ends and i have 1000 of these graphics to generate and i really do not want to go through each one to change the pointsize. It seems that the word wrapping does not seem to work while some others do e.g
convert -size 720x480 xc:transparent -stroke black -strokewidth 1 -fill lightblue -colorspace RGB -depth 10 -font Hiragino-Kaku-Gothic-ProN-W3 -gravity North -pointsize 38 -annotate +0+10 'このかいしゃは ニューヨークしじょうに\nじょうじょうしました。' -annotate +0+100 'konokaishaha nyūyōkushijouni\njoujoushimashita。' /Users/franco/Desktop/Japanese/Banking/Phrase4.png
which use longer sentences
any help would be very appreciated
Thanks
Re: word wrapping issue
Posted: 2008-10-28T08:43:48-07:00
by fmw42
franco64 wrote:Hi and apologies for this stupid question but i just can not figure out why this is happening
I have the following script
convert -size 720x480 xc:transparent -stroke black -strokewidth 1 -fill lightblue -colorspace RGB -depth 10 -font Hiragino-Kaku-Gothic-ProN-W3 -gravity North -pointsize 38 -annotate +0+10 'かいけいぼは きょねん かんさされました。' -annotate +0+60 'kaikeiboha kyonen kansasaremashita。' /Users/franco/Desktop/Japanese/Banking/Phrase20.png
now i know if i reduce the pointsize to 32 it will work for most but i still have some that are just cropped at the ends and i have 1000 of these graphics to generate and i really do not want to go through each one to change the pointsize. It seems that the word wrapping does not seem to work while some others do e.g
convert -size 720x480 xc:transparent -stroke black -strokewidth 1 -fill lightblue -colorspace RGB -depth 10 -font Hiragino-Kaku-Gothic-ProN-W3 -gravity North -pointsize 38 -annotate +0+10 'このかいしゃは ニューヨークしじょうに\nじょうじょうしました。' -annotate +0+100 'konokaishaha nyūyōkushijouni\njoujoushimashita。' /Users/franco/Desktop/Japanese/Banking/Phrase4.png
which use longer sentences
any help would be very appreciated
Thanks
use caption: to get word wrapping
see
http://www.imagemagick.org/Usage/text/#caption
Re: word wrapping issue
Posted: 2008-10-28T12:13:35-07:00
by el_supremo
Try this and see if it produces something close to what you want:
Code: Select all
convert -background none -stroke black -strokewidth 1 -fill lightblue -colorspace RGB -depth 10 -font Hiragino-Kaku-Gothic-ProN-W3 -gravity North -pointsize 38 ( -size 720x480 caption:'かいけいぼは きょねん かんさされました。' -trim ) ( -size 720x10 xc:transparent ) ( -size 720x480 caption:'kaikeiboha kyonen kansasaremashita。' -trim ) -append /Users/franco/Desktop/Japanese/Banking/Phrase20.png
Pete
Re: word wrapping issue
Posted: 2008-10-29T05:34:53-07:00
by franco64
many thanks for the responses. I seem to get an error message when trying the following
convert -background none -stroke black -strokewidth 1 -fill lightblue -colorspace RGB -depth 10 -font Hiragino-Kaku-Gothic-ProN-W3 -gravity North -pointsize 38 ( -size 720x480 caption:' かいけいぼは きょねん かんさされました。' -trim ) ( -size 720x10 xc:transparent ) ( -size 720x480 caption:' kaikeiboha kyonen kansasaremashita。' -trim ) -append /Users/franco/Desktop/Japanese/Banking/Phrase20.png
-bash: syntax error near unexpected token `('
any ideas would be great
thanks
Re: word wrapping issue
Posted: 2008-10-29T07:45:41-07:00
by el_supremo
I use Windows XP and I knew I would forget something when I converted that command back to Linux. The parentheses have to be escaped to get through bash.
Code: Select all
convert -background none -stroke black -strokewidth 1 -fill lightblue -colorspace RGB -depth 10 -font Hiragino-Kaku-Gothic-ProN-W3 -gravity North -pointsize 38 \( -size 720x480 caption:'かいけいぼは きょねん かんさされました。' -trim \) \( -size 720x10 xc:transparent \) \( -size 720x480 caption:'kaikeiboha kyonen kansasaremashita。' -trim \) -append /Users/franco/Desktop/Japanese/Banking/Phrase20.png
Pete
Re: word wrapping issue
Posted: 2008-10-29T17:37:06-07:00
by anthony
Which is why I would like to see a PHP method to execute a command WITHOUT requiring it to be parsed by shell, though you will need to separate the arguments yourself. This is better for option controls as well as for security.
Re: word wrapping issue
Posted: 2008-10-30T02:58:20-07:00
by franco64
unfortunately this don't work as i get the following
What i should get is something like this
but when i do the script i initially made i get and you clearly see that it crops at both ends
I would like to just use 1 font size but if i decrease the font size for some it will make the others look small which i do not want
so anymore help would be grateful
Thanks
Re: word wrapping issue
Posted: 2008-10-30T09:13:51-07:00
by el_supremo
The result you want is essentially what I am getting on my system:
but I suspect that you are using a Mac because the font you're using seems to be supplied with a Mac.
I'm using windows XP Pro SP3 and was testing using Bitstream-CyberCJK which is a free font that I found on the internet.
So, the differences we're seeing may be due to the different fonts or perhaps to a different version of ImageMagick.
Which version of ImageMagick are you using?
My system reports:
Code: Select all
convert -version
Version: ImageMagick 6.4.4 2008-10-09 Q8 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2008 ImageMagick Studio LLC
Pete
Re: word wrapping issue
Posted: 2008-10-30T18:26:39-07:00
by anthony
Check that the spaces are really spaces and not 'hard' or 'no-break' spaces.