I am using a PowerShell script to batch convert Unicode characters to PNG files. See http://pastebin.com/aGJzk4Hh.
I was able to figure out that to convert the " character one must use the designation label:\".
The other special characters are not so simple.
C:\ImageMagick\convert.exe -background transparent -fill hsb(0,0,0) \
-font Arial -pointsize 18 -size 18x26 -gravity center label:"@" \
C:\Users\erics_000\Desktop\Output\Chars\40.png
convert.exe: UnableToAccessPath @ error/property.c/InterpretImageProperties/3330.
convert.exe: NoImagesDefined `C:\Users\erics_000\Desktop\Output\Chars\40.png' @ error/convert.c/ConvertImageCommand/3230.
as well as:
C:\ImageMagick\convert.exe -background transparent -fill hsb(0,0,0) \
-font Arial -pointsize 18 -size 18x26 -gravity center label:"\" \
C:\Users\erics_000\Desktop\Output\Chars\5C.png
convert.exe: NoImagesDefined `label:" C:\Users\erics_000\Desktop\Output\Chars\5C.png' @ error/convert.c/ConvertImageCommand/3230.
have been very problematic for me.
I have tried every way I know how to escape those characters by way of \ however nothing yet has proven to work. I will need to be able to convert all Unicode characters, \ and @ included.
Is it known how these can be converted to PNG files with ImageMagick?
1st question: Did you check that your version of Arial does include glyphs for the Unicode characters in question?
Ok, if it is also about the \ and @ characters, then that shouldn't pose a problem. This leads me to the...
2nd question: Which version of ImageMagick do you have installed? Can you report the result of convert -version?
Here is my result with ImageMagick v6.9.0-0 on a Mac OS X Mavericks 10.9 system:
convert -background black -fill red -pointsize 96 label:' @ \\ @ \\ @ ' sample.png

and (note the blanks starting and ending my string!):
convert -background transparent -fill hsb\(0,0,0\) -font Arial \
-pointsize 180 -size 190x210 -gravity center label:' @ ' \
-frame 1 \
sample2.png

If you need to emit real Unicode glyphs from an input consisting of Unicode character codes, you can do this with the help of Perl. I guess that Powershell has also a method for this, but I'm not familiar with it):
perl -e 'binmode(STDOUT, ":utf8"); \
print " Smiley: \x{263A} "' \
| convert -background black \
-fill red \
-pointsize 98 \
-font Menlo \
label:@- \
smiley.png
(Note: the @- syntax just tells convert to read input string for the label from standard input...)

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With