在 Imagemagick 中转换多个图像 (Windows)
我正在尝试在 Windows 命令行上使用 Imagemagick 将多个 .tif
文件转换为 .png
文件。我尝试了以下方法,但没有成功:
convert -format tif *.png
然后我尝试了一个循环
for %a in (*.tif) do convert %a %a.png
,该循环确实有效,但现在我所有的图像都被命名为 [something].tif.png
,这很烦人。
那么为什么第一个命令不起作用,如果没有办法让第一个命令起作用,有没有办法改进第二个命令,这样我就不必处理 .tif
在 .png
图像名称中?
编辑 看来我的第一个命令是错误的。首先,convert
不起作用,但 mogrify
起作用。我读过 mogrify 替换了旧格式的文件,但显然这不是真的,因为它为我创建了新图像而不删除旧图像。其次,目标文件类型似乎是第一位的,因此该命令
mogrify png *.tif
运行得很好。
我仍然想知道如何改进第二个命令。
I'm trying to convert multiple .tif
files into .png
files using Imagemagick on the Windows command line. I tried the following, which didn't work:
convert -format tif *.png
I then tried a loop
for %a in (*.tif) do convert %a %a.png
which did work but now all my images are named as [something].tif.png
, which is annoying.
So why didn't the first command work, and if there's no way to get the first command to work, is there a way to improve the second command so I won't have to deal with the .tif
in the .png
image name?
Edit It seems that I got the first command wrong. First of all, convert
doesn't work but mogrify
does. I had read that mogrify replaced the files of the old format, but apparently it isn't true because it created new images for me without deleting the old ones. Secondly, it seems that the destination file type comes first, so the command is
mogrify png *.tif
which works perfectly.
I'd still like to know how the second command could be improved.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么不使用
mogrify
?将从
1.png
创建1.tif
... 从N.png
创建N.tif
。Why don't you use
mogrify
?will create
1.tif
from1.png
...N.tif
fromN.png
.