Hack 99. Image Conversion in a Pinch
When you need to convert images from one format to another or shrink the size of existing images, try these two graphics tools.
I frequently have to convert graphics from one format to another. For example, I might need to convert a high-quality, very large bitmap TIFF file to a much smaller GIF or JPEG for posting to the Web. Sometimes, I need to shrink the size of a file, while keeping the same formatfor example, when sending a picture via email to relatives or friends. When I'm creating my own icons [Hack #19], I need to convert graphics to the .ico format. Also, I sometimes work with an artist who needs a file in a particular format.
XP's built-in Paint program can't really do the trick. It can convert only a handful of graphics formats (for example, it can't handle .pcx or .ico format), and it won't let you customize the graphic; for example, you can't alter the compression of .jpg files to make them smaller. Also, it can't do batch conversions; to convert a file you have to open it and then save it in a different format.
For the kind of image conversion I do, I don't need a full-blown graphics program like Photoshop that carries a full-blown price tag of up to $600 (Photoshop Elements is an alternative, but that's not free either). Instead, I turn to the freeware and shareware programs detailed in the rest of this hack.
For most image-conversion chores, I turn to the free program IrfanView (http://www.irfanview.com), which is named after its creator, Irfan Skiljan. It lets you convert images individually or in batches, handles a wide variety of formats, and gives you a great deal of control over the conversion. For example, when converting to a JPEG, you can set the image quality, whether to save as color or grayscale, and whether to save as a progressive graphicone that gradually paints on the screen as it downloads over the Web.
To do a batch conversion, after you run the program choose File Batch Conversion, browse to the directory that has the files you want to convert, and select them. Choose the output format and any options you want to apply to the files. For example, for a certain project I needed to convert a group of large graphics in TIFF format to JPEG format, and the resulting files had to be very small, in grayscale, and in progressive format. Figure 11-1 shows the options I chose in IrfanView.
Figure 11-1. Converting a batch of files with IrfanView
If you need to convert only an individual file, call up the file, save it in whatever format you want, and use options like those shown in Figure 11-1.
IrfanView does much more than image conversion. I use it as my all-purpose file viewer, for example. It also works with scanners to bring images into your PC, and it includes basic image-editing tools.
11.2.2. Image Converter .EXE
One thing IrfanView can't do is display before-and-after pictures of the graphic you're converting. For example, you can't preview what the converted picture will look like after it is converted. This can make image conversion a hit-or-miss affair: first you'll have to choose your conversion options, then convert the image, and then finally look at the output. If you're not happy with the results, you have to start back at the beginning, choose different options, and hope this time it works.
Image Converter .EXE (http://www.stintercorp.com/genx/imageconverter.php) shows you a side-by-side comparison of the before-and-after images, before you do the actual conversion. It also shows you the size of each image. That way, before you do the conversion, you can keep tweaking it until you have the size and quality you want. Figure 11-2 shows an example of shrinking a JPEG file while still trying to retain as much detail and quality as possible. The image on the left is the original image and is 242KB. The one on the right is only 36KB, but there is very little difference in the quality of the two, so I chose to save the one on the right.
Figure 11-2. A side-by-side comparison of image quality and size
The program does batch conversions, and it lets you convert files one at a time. It also lets you edit and add a wide variety of special effects when you convert, such as changing the color depth and contrast, adding a motion blur, posterizing the image, and more. The program is shareware and free to try, but you're expected to pay $35 if you decide to keep it.
11.2.3. See Also