Page 1 of 1

Convert UTF-8 textfile runtime bug

Posted: 2018-12-06T20:24:40-07:00
by tltan
I have a text file with contents as follows:
LINE 1
LINE 2
LINE 3

This file is saved as Normal.TXT (normal ANSI text file) and UTF8.TXT (UTF-8 format text file).

I ran the following commands:
convert -background white -fill black -font simhei -pointsize 60 -size 3020x caption:@Normal.TXT Output1.JPG
convert -background white -fill black -font simhei -pointsize 60 -size 3020x caption:@UTF8.TXT Output2.JPG

The first convert works fine, as expected.
The second convert has an unexpected problem. Output as follows:
LINE1
LINE2
LINE3

As you can see, LINE1 has been offset.

Anyone has any ideas how to fix this so that Output2 looks exactly like Output1? I need UTF-8 support because I need to support Chinese characters. Please help.

Re: Convert UTF-8 textfile runtime bug

Posted: 2018-12-06T20:28:06-07:00
by tltan
On the second output, Output2, the first line is offset with a couple of spaces in front of LINE1 (i.e. " LINE1"). Note: it did not show up correctly in my original post. Any help is much appreciated.

Re: Convert UTF-8 textfile runtime bug

Posted: 2018-12-06T20:41:41-07:00
by fmw42
You do not say what version of ImageMagick, date and platform? Also what delegates and what version of freetype? Does simhei support UTF-8 characters? I do not see any offset. Perhaps you should post your output images to some free hosting service and put the URLs here.

__________________________

Please, always provide your IM version and platform when asking questions, since syntax may differ.

Also provide your exact command line and your images, if possible.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli


For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
https://imagemagick.org/script/porting.php#cli

Re: Convert UTF-8 textfile runtime bug

Posted: 2018-12-07T06:06:50-07:00
by snibgo
I guess you use Windows, and your file was saved with a "Byte Order Mark" header. If so, the cure is to use software that doesn't write a BOM, or to strip the BOM after the file is saved.