【发布时间】:2015-07-10 22:17:14
【问题描述】:
我正在使用 PowerShell 脚本将 Unicode 字符批量转换为 PNG 文件。见http://pastebin.com/aGJzk4Hh。
我发现要转换 " 字符必须使用指定标签:\"。
其他特殊字符就没那么简单了。
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.
还有:
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.
对我来说非常有问题。
我已经尝试了所有我知道如何通过\ 转义这些字符的方法,但是没有任何方法被证明是有效的。我需要能够转换所有 Unicode 字符,包括 \ 和 @。
是否知道如何使用 ImageMagick 将这些文件转换为 PNG 文件?
【问题讨论】:
-
您应该首先将
label:"\"替换为label:" \ "(注意添加的空格!)。也将label:"@"替换为label:" @ " -
可以的。我认为就我的脚本而言,最好的解决方案是使用 @ 来指定一个内部包含单个 Unicode 字符的文件。当我发布到 ImageMagick 开发者论坛时,我现在才知道@ 的含义。我在下面对您的回答发表了另一条评论。您的解决方案有效,但是它将导致更宽的图像,这可能不是我想要发生的,因为我打算将输出用于 OpenGL ES 中的纹理映射文本。感谢您发布它非常感谢。
标签: imagemagick imagemagick-convert