Monday, October 25, 2010

Use ImageMagick to convert a set of images

While reporting my experiment output from LTSpice I need to save the plots I get as wmf (because it's the only supported image format in this software) then change the format to png to be easily loaded in my latex file.

To achieve this goal I have used ImageMagick. ImageMagick is a really powerful set of tools to manipulate images in command line which allow me to just type a easy command to get my png ready to be used in my tex file.

I have been using the convert command:
convert foo.wmf foo.png

Today I needed to convert a bunch of images so using convert would be a little painful. A quick google show me the answer to my problem: mogrify

With mogrify command you can change the format for every image you tell it in your shell. So to modify all wmf images in a directory now I just need execute:

mogrify -format png *.wmf

And that's it. I hope some of you find it useful.

No comments:

Post a Comment