Convert from One Image Format to Another
Use the ImageMagick convert tool to change between image formats.
When you deal with images on a regular basis, it’s often useful to convert them to different image formats. You can use graphical tools such as the GIMP to open files and save them into different formats, but if you deal with a lot of images you might find that process a bit cumbersome. The ImageMagick tool convert solves this problem by providing a command-line interface to image conversion. With convert you can change any ImageMagick-supported image format to any other ImageMagick-supported image format. The full list of supported formats is rather large—you can view the full list in the ImageMagick man page (the man page is ImageMagick, not imagemagick)—but among the supported formats are BMP, CMYK, GIF, JPEG, PBM, PNG, RGB, SVG, TIFF, and XPM.
The ImageMagick tools are commonly used by a number of other frontends, so you are likely to find the convert tool already packaged for your distribution with the rest of the ImageMagick tools. The standard usage of convert is simple: provide an input file and an output file as arguments, and convert will figure out the format based on the file extension. So, to convert a BMP to a PNG, type:
$ convertimage.bmp image.png
One of the advantages to a command line image conversion tool is that it lends itself really well to scripting. For instance, the following command converts an entire directory of BMP files to JPEG—the bit of sed in ...