ImageMagick:转换为转换后的图像保持相同的名称 [英] ImageMagick: convert to keep same name for converted image
问题描述
我正在将.psd转换为文件夹内的.png文件。如何在不同扩展名的文件夹中保留每个文件的相同名称?
I am converting .psd to .png files inside folder with one. How to keep same name of every file in folder with different extension ?
例如我输入文件夹图像然后从终端执行
For example I enter in folder images and then from terminal I execute
$ convert *.psd *.png
但它给.png的名字只是与相应的.psd图像不同的数字。
but it gives names to .png just numbers not the same as appropriate .psd image.
推荐答案
使用 -set
和格式化选项。
convert *.psd -set filename:base "%[base]" "%[filename:base].png"
请参阅长表格属性百分比逃脱和 Filename Percent Escapes docs。
更新
imagemagick随附的 mogrify 实用程序也可以使用。
The mogrify utility that ships with imagemagick can also be used.
mogrify -format png *.psd
注意:小心mogrify作为文档状态......
Note: Be careful with mogrify as the docs state...
这个工具类似于转换,除了原始使用您请求的任何更改覆盖图像文件(除非您使用-format选项更改文件后缀)。
This tool is similiar to convert except that the original image file is overwritten (unless you change the file suffix with the -format option) with any changes you request.
这篇关于ImageMagick:转换为转换后的图像保持相同的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!