1

I try to use ImageMagick to handle a Chinese character to a image on my MacBook.

According to ImageMagick's guide Unicode or UTF8 Format Text, I tried two ways.

Code one:

convert -background lightblue -fill blue \
-size 165X270 -pointsize 24 \
-gravity center -font Andale Mono \
label:'中' label.png

Code two:

I write the Chinese character in a text file, and add .utf8 to its file name.

convert -background lightblue -fill blue \
-size 165X270 -pointsize 24 \
-gravity center -font Andale Mono \
label:@chin.utf8 label.png

Both do not work. And the result is the same

enter image description here

Many Thanks In Advance , :-)

4
  • 1
    You need to use a TTF file that contains Chinese characters in it - then it will work fine. "Andale Mono" is not the right choice. Dec 12, 2017 at 15:59
  • Yes, I will try. i asked a question stackoverflow.com/questions/47775394/…
    – dengApro
    Dec 12, 2017 at 16:10
  • ps: I could not get your @chin.utf8 command to work. Dec 13, 2017 at 10:37
  • I write the Chinese character in a text file, and add .utf8 to its file name. That is chin.utf8 file
    – dengApro
    Dec 13, 2017 at 10:52

2 Answers 2

2

Use a font that contains Chinese characters, best thing to do is use a Unicode font.

convert -background lightblue -fill blue \ -size 165X270 -pointsize 24 \ -gravity center -font "/Library/Fonts/Arial Unicode.ttf" \ label:'中' label.png

You can easily find suitable fonts using macOS Font Book app.

2
0

An instance answer:

convert -background lightblue -fill blue \
-size 165X270 -pointsize 24 \
-gravity center -font "/Library/Fonts/Microsoft/Kaiti.ttf" \ label:'好' labelOne.png

Thank Matt Sephton's guide

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .