如何在ImageMagick中使用输入文件名? [英] How do I use the input filename in ImageMagick?
本文介绍了如何在ImageMagick中使用输入文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
根据ImageMagick文档,我希望这样:
According to the ImageMagick documentation, I would expect this:
convert fountain-pen1.jpg fountain-pen2.jpg handwriting.jpg -resize 400x400\> -set filename:f '%t_smol.%e' '%[filename:f]'
得出fountain-pen1_smol.jpg fountain-pen2_smol.jpg handwriting_smol.jpg
.
相反,它只会创建fountain-pen1_smol.jpg
.
我在做什么错了?
我也尝试过使用*.jpg
来得到相同的输出.
I've also tried with just *.jpg
which results in the same output.
convert -version
Version: ImageMagick 6.9.7-4 Q16 arm 20170114 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib
推荐答案
Mmm... sometimes you need to give ImageMagick a hint to create more output files than it is expecting to, using +adjoin:
convert fountain-pen1.jpg fountain-pen2.jpg handwriting.jpg -resize 400x400\> -set filename:f '%t_smol.%e' +adjoin '%[filename:f]'
如果您在文件名中放入%02d
或类似名称,它会猜测是否成立,但对于您的用例却不知道.
It guesses this if you put a %02d
or somesuch in the filename, but doesn't know that for your use case.
这篇关于如何在ImageMagick中使用输入文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文