Tuesday, March 30, 2010

How to convert multiple images (command line)

Using Imagemagick, it is very easy.

Say we have a bunch of bmp files we want to convert to png. This hack assumes a couple of things:
1. The picture files end with bmp. On Linux and other unixy OSes, this is important. Not so important on Windows.
2. The mogrify command alters the original file so you may want to back up your files before doing this. :)

So with the disclaimer behind us, here's the command:

mogrify -format png *.bmp

So I'm not sure why mogrify is behaving this way, but I just tried in on my Opensuse 11.1 with Imagemagick version 6.4.3 and the files were not mogrified. Instead of overwriting the file, a new file with a png extension was created. Which makes sense now that I think about it. :)

No comments: