如何转换名称 imagemagick 中带有空格的文件

how to convert files with spaces in the names imagemagick

文件路径如C:\test\NPP3083-A_BELI Frenchips Poulet roti face.eps

该命令适用于文件名中没有空格的文件,但有空格时会出现如下错误:

{convert: unable to open image 'C:\test\NPP3083-A_BELI': No such file or directory @ error/blob.c/OpenBlob/3094.convert: no decode delegate for this image format ' @ error/constitute.c/ReadImage/509.convert: unable to open image 'Frenchips': No such file or directory @ error/blob.c/OpenBlob/3094.convert: no decode delegate for this image format' @ error/constitute.c/ReadImage/509.convert: unable to open image 'Poulet': No such file or directory @ error/blob.c/OpenBlob/3094.convert: no decode delegate for this image format ' @ error/constitute.c/ReadImage/509.convert: unable to open image 'roti': No such file or directory @ error/blob.c/OpenBlob/3094.convert: no decode delegate for this image format' @ error/constitute.c/ReadImage/509.convert: unable to open image 'face.eps': No such file or directory @ error/blob.c/OpenBlob/3094.convert: invalid argument for option '-resize': C:\test\NPP\EpsTestOutputs\epsToJpg.jpg @ error/convert.c/ConvertImageCommand/2588.}

编辑 2:在输入文件名中用 %20 替换空格不起作用,出现以下错误:

{convert: unable to open image 'C:\test\NPP3083-A_BELI%20Frenchips%20Poulet%20roti%20face.eps': No such file or directory @ error/blob.c/OpenBlob/3094.convert: invalid argument for option '-resize': C:\test\NPP\EpsTestOutputs\epsToJpg.jpg @ error/convert.c/ConvertImageCommand/2588.}

如有任何帮助,我们将不胜感激。如果需要任何信息,请告诉我。

添加引号和传递参数以调整大小解决了这个问题。 传递给 imagemagick 的最终字符串如下

"convert \"C:\test\NPP\223083-A_BELI Frenchips Poulet roti face.eps\" -density 300 -resize 1024x768 C:\test\NPP\EpsTestOutputs\epsToJpg.jpg"

感谢所有对此问题发表评论的人。干杯