Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert multiple images in Imagemagick (Windows)

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.

like image 900
Tianxiang Xiong Avatar asked Jan 26 '12 21:01

Tianxiang Xiong


People also ask

Is GraphicsMagick better than ImageMagick?

Some of the advantages GraphicsMagick has over ImageMagick include more efficiency, a smaller size, fewer security exploits and is generally more stable than ImageMagick.

Does ImageMagick use ffmpeg?

FFMPEG and ImageMagick can be categorized as "Image Processing and Management" tools. AmperVue, Mux, and AbemaTV are some of the popular companies that use FFMPEG, whereas ImageMagick is used by Swingvy, Cloud Drive, and Sotong Kitchen.


1 Answers

Why don't you use mogrify?

mogrify -format tif *.png

will create 1.tif from 1.png ... N.tif from N.png.

like image 144
Zsolt Botykai Avatar answered Oct 05 '22 02:10

Zsolt Botykai