gm icon indicating copy to clipboard operation
gm copied to clipboard

Special characters on Windows 10

Open jankomartin opened this issue 8 years ago • 4 comments

Hello, I'm working on multiplatform application (windows, unix / mac) and need to process images (inprint text, resize, ...). I have tried to use the graphicmagick for this purpose but I'm getting weird results. Please can you advice ?

I'have installed on Windows: GraphicsMagick-1.3.26-Q16-win64-dll I'm using following command: gm convert -encoding "Unicode" -font "Calibri" -draw "text 100,100 '-лисица-'" orig.jpg _yyy.jpg

The output image contains "?????" instead of "лисица", the same command on Mac/Unix insert proper characters into image.

I have also tried to use ImageMagick with the same arguments and got correct results also on Windows, therefore I assume that there is no "Font" issue. magick convert -encoding "Unicode" -font "Calibri" -draw "text 100,100 '-лисица-'" orig.jpg _yyy.jpg

Please can you advice how to fix this issue? I would like to use GraphicMagick instead of ImageMagick due the performanca and resource issues.

Best regards

jankomartin avatar Sep 06 '17 09:09 jankomartin

I'm getting the same problem here. When I try to use the euro (€) symbol. Other symbols in the same font like letters or numbers or even other currency symbols work just fine. This issue is driving me crazy, Any idea?

pjanaya avatar Sep 18 '17 21:09 pjanaya

Hello, I narrowed that problem to GraphicMagick as backend for "gm" library. When I have replaced the backend with ImageMagick everythink work as expected. The only drawback is that ImageMagick is slower. In my case it is slower around 10-30%, but in a mean while I do not have any solution. I reported this also to graphicmagick team as (https://sourceforge.net/p/graphicsmagick/bugs/455/) but so far no response / activity.

jankomartin avatar Sep 19 '17 07:09 jankomartin

ImageMagick works indeed. I'll see what I can do. Thanks for the help!

pjanaya avatar Sep 19 '17 08:09 pjanaya

The easiest fix is to make Windows apps (i.e. gm.exe) run in the UTF-8 code page, and not bother w/ UTF-16 wide char translation and "legacy" -W APIs. Note that this works only for Windows 10 1903 and later.

Examples:

https://github.com/libjxl/libjxl/commit/7b70ef19383a73d8a44bd9bbe15df140412df300 https://github.com/Exiv2/exiv2/commit/018e5847f5e5db7935a92f4a9c3fadc9826b064d https://github.com/AOMediaCodec/libavif/commit/3ec01cefd1ddd266a622d5e114a0888581b68f4a

kmilos avatar Dec 11 '24 09:12 kmilos