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
word wrapping issue
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: word wrapping issue
use caption: to get word wrappingfranco64 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
see http://www.imagemagick.org/Usage/text/#caption
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: word wrapping issue
Try this and see if it produces something close to what you want:
Pete
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
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
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
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: word wrapping issue
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.
Pete
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
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: word wrapping issue
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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: word wrapping issue
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
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
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: word wrapping issue
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:
Pete
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
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: word wrapping issue
Check that the spaces are really spaces and not 'hard' or 'no-break' spaces.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/