how to apply imagemagic to other language?

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

To annotate Chinese words you need to UTF-8 encode them before you pass them to the -annotate or -draw options. You must also have a font that supports the characters as well.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

ImageMagick requires the Freetype delegate library. To determine if it is included in your current binary version, type
  • identify -list configure
and look for -lfreetype in the LIBS tag. If its not there you need to install it on your system and build ImageMagick from source. When you run the configure script it will tell you whether it finds the Freetype library or not. Once you have it you can annotate an image with text.

You will of course need a Truetype font and a UTF-8 encoded string. To verify the combination and the UTF-8 encoded string will work properly you can post a URL to the font and the string here and we will verify it will work properly with ImageMagick and Freetype.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

Ok, Windows includes Freetype support. You can verify with
  • identify -list format
and it will mention the Freetype delegate library version number for the TTF tag.

We are willing to verify whether the Chinese characters you posted will render with ImageMagick just as soon as you make simsun.ttf available to us to test.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

Your Freetype version should be fine. Give us a chance to test your font with Chinese characters to ensure it works properly. We will get back to you in the next day or two.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

We could not read simsun.rar with the unrar utilitiy. It got a header error. Try posting it with the more common Gzip or Bzip compression (i.e. .gz or .bz2).
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

We have successfully displayed the Chinese characters you posted with the simsum.ttc font file. However, it did require a one line patch. We will have the patch in ImageMagick 6.2.1-2 Beta within a day or two. Thanks for the problem report.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

We're releasing ImageMagick 6.2.1-2 today with the font patch to support Chinese characters. The command we used is:
  • convert -pointsize 72 -encoding unicode -fill white -font simsun.ttf -size 500x200 xc:black -draw "text +20+100 '测试用的汉字'" chinese.jpg
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

We develop under Linux and the chinese characters can be passed from the command line but under the Windows shell we noticed it could not. We tried it from a chinese.bat script and it produced gibberish. That means you will need a program to convert the chinese characters to unicode/utf-8 before it is passed to the -draw option.
Post Reply