IM 6.7.9-Q16 draw text with accented chars in Windows .bat

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
juef
Posts: 3
Joined: 2013-09-23T06:25:07-07:00
Authentication code: 6789

IM 6.7.9-Q16 draw text with accented chars in Windows .bat

Post by juef »

Greetings,

I am trying to append some text to an image using ImageMagick's convert and draw. I use the following command:

Code: Select all

convert  -draw "text 0,0 'Écolière'" -font arial-unicode.ttf 1.png 2.png
When used in Ubuntu, or when used in Windows and typed directly into the command line prompt, the desired output is produced perfectly. However, putting the command in a batch file produces garbage characters instead of the 'É', 'è' and such. I have tried changing the batch file's encoding to ANSI, UTF-8, and basically every other encoding Notepad++ offers but with no success. I also tried changing the EOF to UNIX style, which unfortunately didn't work.

Is there any way to use these special characters in a Windows batch file?

Thank you for your time and please have a nice day!
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: IM 6.7.9-Q16 draw text with accented chars in Windows .b

Post by dlemstra »

Have you tried a newer version of ImageMagick? Your version is almost a year old.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
juef
Posts: 3
Joined: 2013-09-23T06:25:07-07:00
Authentication code: 6789

Re: IM 6.7.9-Q16 draw text with accented chars in Windows .b

Post by juef »

Thank you for your reply!

I had not realized that 6.7.9 was so old, sorry. I just tried with 6.8.6-10-Q16-x86-dll and the results are the same.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: IM 6.7.9-Q16 draw text with accented chars in Windows .b

Post by snibgo »

Try

Code: Select all

chcp 1252
before your convert command.
snibgo's IM pages: im.snibgo.com
juef
Posts: 3
Joined: 2013-09-23T06:25:07-07:00
Authentication code: 6789

Re: IM 6.7.9-Q16 draw text with accented chars in Windows .b

Post by juef »

That does work, thank you! Apparently the default code page on my system is 850, which is 'Multilingual (Latin I)', identified by 'OEM 850' in Notepad++. That code page does support accented characters, but apparently not with the same codes.

I would have never found that by myself, so thanks again very much!
Post Reply