Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.
I use this
gm convert -font C:\Windows\Fonts\simsun.ttc -fill red -pointsize 18 -draw "text 0,80 '我们一起'" -encoding gb2312 D:/testimg/test.gif D:/testimg/convert.gif
to draw a chinese, the result the chinese is mess,how can i do with this ? pls help me ,thanks a lot.
Here is the converted image
Due to a geographic accident of my birth, I am likely much less helpful than I should be. :-)
The first thing to try is to re-order your options in left to right order in the order they need to be used. For example:
gm convert D:/testimg/test.gif -encoding gb2312 -fill red -pointsize 18 -font C:\Windows\Fonts\simsun.ttc -draw "text 0,80 '我们一起'" D:/testimg/convert.gif
The reason why ordering may be important is that your -encoding request currently comes after the point where it is used. It is used in -draw so make sure that it comes before -draw.
I change the order of options as you suggested,the converted image is still mess.
I see the draw Russian text problem,is my question the same reason with that proble? Is there another way to draw a chinese text on image use GrophicsMagick?
The problems that the Russian user faced are likely similar except that Chinese has much larger character sets than Russian does. He did achieve success using UTF-8 encoding. I really don't know much about these encodings except that I know the encoding is passed to the FreeType library and that there needs to be a translation to a glyph in the font definition file.
I use another way to solve this problem, I see the ImageMagic handle Chinese , then i use the same way to draw a text on image,it works fine.
facing the same issue
ImageMagic works fine:
convert " "mindon.png" "-encoding" "Unicode" "-font" "simhei" "-draw" "gravity south text 0,0 \"麥盾\"" "result.png"
but not GraphicsMagick:
gm "convert" "mindon.png" "-encoding" "Unicode" "-font" "simhei" "-draw" "gravity south text 0,0 \"麥盾\"" "result.png"
In order to work, the font file actually used would need to support the specified encoding. Although -font simhei was specified, perhaps some other font file was actually used (due to substitution). How did you assure that the correct font file was used?