Hack 21 Image Conversion in a Pinch


The ability to convert images from one format to another with minimal retouching and manipulation is built right into Mac OS X.

Every so often ? but not often enough to warrant shelling out for a full-scale draw or paint program ? I find myself needing to convert an image from one format to another. Perhaps I have a photo in TIFF format I'd like to incorporate into my web site as a JPEG or GIF. Or I need to share a screenshot with a Windows user who prefers BMP to PNG.

Thankfully, OS X users have some minimal functionality for image conversion and alteration built right into their OS.

21.1 Preview

Preview takes me back to the days when a web browser became a launchpad for a plethora of helper apps, specialized viewers for images, movies, or sounds. It's the helper you always wished for for all things image, able to open, save, and convert PDF, JPEG, TIFF, PNG, and others, as well as to export a Photoshop image as a GIF, a Windows BMP to Quicktime, or a fancy new PNG to old faithful MacPaint.

Open an image via File Open, figs/command.gif-O, or double-clicking an image file or dragging and dropping it to Preview's Dock or Finder icon. Choose File Export . . . , pick an output format, and save. For a mite more fine-tuning, click the Options . . . button in the Save sheet to set color depth, simple filtering, interlacing, and the like, as shown in Figure 3-13.

Figure 3-13. Exporting to a different image format

Now, don't expect much more than open and save. Preview has some minimal flipping and rotating, but that's about it. Most notably lacking is the ability to crop, a must-have when creating screenshots or a doing a quick hack job on an unduly large image before forwarding it via email.

21.2 iPhoto

iPhoto (http://www.apple.com/iphoto/), while best suited to its primary role of digital shoebox, does provide some useful conversion facilities in a pinch. It's far more limited than Preview in the image formats it supports (JPG, TIFF, and PNG) but has a good deal more features up its sleeve: scaling, simple brightness and contrast controls, red-eye reduction, rotation, cropping, one-click enhance, retouching, and converting to black and white.

Launch iPhoto. Drag one or more images into its window or select files via File Import . . . iPhoto will import your specified images and add them to its library. Click the Last Import roll in the lefthand pane to narrow your view to only what you just imported. If you'd like to do some editing, select an image and click Edit at the bottom of the Preview (righthand) pane.

Most apropos to what we're trying to accomplish is iPhoto's ability to convert multiple files at once. When you're ready to save, go back to the organize view by clicking Organize at the bottom of the preview pane, select (#) the images you wish to save, and choose File Export . . . or press figs/command.gif-E. Choose the File Export tab, make any size adjustments you wish, pick a format, and click Export. iPhoto will prompt you with the standard OS X Save dialog for a preferred export location.

21.3 Graphic Converter

The venerable Graphic Converter (http://lemkesoft.com/us_gcabout.html) shareware app (U.S.$30 in Europe, U.S.$35 in the rest of the world at the time of this writing) makes the transition over from OS 9 to carbonized OS X. It's been the Swiss Army knife for images on the Mac as far back as 1993, importing around 160 image file formats and exporting to around 45. Graphic Converter supports batch conversion, is AppleScript-aware (http://lemkesoft.com/us_scripts.html), and sports a comprehensive toolset including: rotation, comprehensive level adjustment, sharpen and blur, cropping, and lots more.

21.4 More

Of course if you need more advanced image manipulation and drawing tools, you may be in the market for something like Photoshop or Illustrator. The major drawback is, of course, price; comprehensive commercial packages do come rather dear. A free, open source alternative is The Gimp (http://gimp.org/), the GNU Image Manipulation Program (read: Photoshop-alike); although it runs only under X11 for Mac OS X (http://www.apple.com/macosx/x11) or XonX (http://mrcla.com/XonX/) (that's X Windows on OS X), you certainly can't beat the power/price combination.