Hack 86 Image Conversion in a Pinch


When you need to convert images from one format to another, or need to 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 may 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 format?for 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. There are also times when I 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. And 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 another alternative, but that's not free either). Instead, I turn to the freeware and shareware programs detailed in the rest of this hack.

10.2.1 IrfanView

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 individual images or batches of images at a time, 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 it as a progressive graphic?one 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, grayscale, and in progressive format. Figure 10-1 shows the options I chose in IrfanView.

Figure 10-1. Converting a batch of files at a time with IrfanView

If you need to convert only an individual file, then call up the file, save it in whatever format you want, and use options like those shown in Figure 10-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.

10.2.2 ImageConverter .EXE

One thing that 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: you'll first 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 one works.

ImageConverter .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 10-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 242 KB. The one on the right is only 36 KB, but there is very little difference in the quality of the two, so I chose to save this one.

Figure 10-2. A side-by-side comparison of image quality and size

The program does batch conversions, as well as letting 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.

10.2.3 See Also

  • Paint Shop Pro (http://www.paintshoppro.com) is an excellent all-around graphics program that also does image conversion, including batch image conversion. It's shareware and free to try, but it has a registration fee of $99.