MacDevCenter    
 Published on MacDevCenter (http://www.macdevcenter.com/)
 See this if you're having trouble printing code examples


What Is Preview (and Why You Should Use It)

by Giles Turnbull
07/19/2005
Running Mac OS X on Windows
Preview
Apple's Preview application (which is included as part of Mac OS X Tiger) is best known as a PDF viewer and a Macintosh alternative to Adobe Reader. You can bookmark PDF pages, add comments, fill out PDF forms, and copy text selections from within the file. This software, however, is also a capable image viewer for file formats such as JPEG, GIF, PNG, PSD, PICT, TIFF, and others, and it even allows you to edit those images. Preview can capture screenshots by selecting the Grab utility under its File menu. Many Mac users prefer using Preview over Adobe Reader because it takes less time to open and renders file pages very quickly.

Many people only know Preview as Apple's humble PDF viewer. Rather than mess about waiting for Adobe Reader to launch itself, plugins and all, Preview opens faster and does the job just as well.

But there's so much more to this application.

It turns out that Preview, especially the most recent version shipping with Mac OS X 10.4 Tiger, has plenty of extra features that can elevate it to one of your favorite utilities. Its usefulness is further enhanced by the fact that it's AppleScriptable, meaning that it can perform many tasks within an Automator workflow.

Here's a quick guide to some of the useful chores you can accomplish with this software.

Preview Is a Photo Editor!

Who knew? It's not like there's even a toolbar button you can use to access this feature, but believe it or not, hidden away under the Tools menu is a little thing called Image Correction (you can call it up with the keyboard shortcut Option+Command+C).

Lo and behold, it's a list of sliders that lets you change all sorts of aspects of your image, such as saturation, sharpness, exposure, and more. Looks kind of familiar, doesn't it?

Hmmm. Preview's image editing panel, and iPhoto's. Separated at birth? Hmmm. Preview's image editing panel, and iPhoto's. Separated at birth?Hmmm. Preview's image editing panel, and iPhoto's. Separated at birth?

Yup, this bunch of editing controls is almost identical to the (much slicker-looking) image editing controls that appeared in iPhoto 5. It's all thanks to the system-level Core Image code. The result is that they look very similar, and do the same sort of tasks.

Interestingly, iPhoto 5 won't even load these advanced controls on anything less than a G4 machine. There simply won't be sufficient processing power to use them. Preview is happy to display the controls even on an old G3, but don't expect it to achieve much except on the smallest and most basic images. Trying to change the exposure and saturation of a large photo on a G3 machine only brings up the spinning beach ball of doom, so don't bother.

On a G4 and above, though, Preview suddenly becomes a very useful little image editor, one that comes without what some people might consider the "bloat" of iPhoto.

While sliders are not the user-interface widget that most professionals would choose for changing things like exposure settings, the controls are more than adequate for editing casual snapshots, photos for the web, or other nonprint pictures.

Preview lets you crop, flip, and rotate images. You can convert from one image type to another just by using Save As... It's got many of the essential features you'd find in dozens of other image editing applications, but has the benefit of being free and closely tied in to the rest of Mac OS X. Preview is starting to look a lot like iPhoto in terms of the image manipulation features it offers. We'll see more similarities as we go on.

Another feature borrowed from iPhoto is the chance to add keywords, although it is a bit unwieldy. Hit Command+I to call up the Info panel for any picture, and you'll see a Keywords tab. Adding keywords requires too many mouse clicks for my liking. A simple empty field into which you could type space-separated keywords would be much simpler, especially if it were a toolbar control that could be slotted in above every image. But the feature is there, if you want to take the time to use it.

Adding keywords in Preview
Adding keywords in Preview

Keywords added this way are instantly searchable in Spotlight, which make them useful for archiving. Sadly they don't show up if you drag the image into iPhoto and call up its Info panel there.

Preview's Behavior

It's worth remembering that Preview behaves slightly differently, depending on what kind of file it is displaying.

To see the differences, try opening two files: one image, and one PDF.

Compare the toolbars on the two windows. They're different, offering different tools and controls. Some things you can do with images, but can't do with PDFs, and vice versa.

Try customizing those toolbars (Control-click anywhere on the toolbar and a sheet will slide out with options on it), and you'll see that what you're offered for these different file types varies.

Some of the choices are a bit odd in this regard. There's a toolbar button for cropping PDFs, but not one for cropping images, even though the same function is available with both, and can be invoked with the same keyboard command (Command+K).

Another oddity: the Tools Mode selector (more about this later) is not available when viewing images, so you might think that, if you've zoomed in on a photograph, there's no means of dragging it around with the mouse, because you have no access to a Move tool. Turns out you can dragójust hold down the Space bar while dragging.

Once you've noticed these strange quirks, you'll start to feel much more at home in Preview.

A Simpler PDF Viewer ... and More

Long-time Mac users will remember the old days, when Adobe's Reader (then known as Acrobat Reader) was pretty much the only consumer application available for opening PDF files.

Admittedly, in those early days it didn't matter much anyway, because without widespread internet access, PDFs weren't distributed very far.

Now that broadband Internet access is everywhere, corporations and governments don't think twice about releasing PDF-format documents at every opportunity. With Preview, Mac OS X has offered an easy-to-use alternative for the first time.

Preview makes for a very capable, speedy, and usable PDF viewer, and includes some handy little tools that you might not have tried experimenting with.

Lots of PDFs (especially long, wordy documents) come with "bookmarks" that let you jump around within the document, from one place to another.

Preview supports this idea, using either page titles or thumbnails in the drawer to display all the bookmarks you might want to access.

But there's also a bookmarks feature that's new in Preview 3.0.1 (shipping with Tiger) that allows you to add a bookmark to any PDF, or intriguingly any image, or your computer and reopen it from Preview.

You could think of it almost like a browser bookmarks menu. If you're halfway through a huge text document and need a break, you can hit Command+D to add a bookmark. The same applies for images you might want to use often.

The bookmarks list
The bookmarks list

Give your bookmark a name, and in future it will be available in Preview's own Bookmarks menu. One click, and the file is opened. If it's a multipage PDF, it will snap straight to the page where you applied the bookmark.

Simple PDF Editing Tools

Preview also includes several new tools for making some annotations and edits to PDF files.

Tool Mode control Tool Mode control

The Tool Mode Toolbar control is probably the simplest way of switching from one tool to another, although not everything considered a "tool" is contained within it. More tools are available under the Tools menu.

Making annotations Making annotations

For example, you can use the Select tool mode to draw a rectangular shape over any part of a PDF, which you can then crop with the Tools -> Crop menu item, or just by hitting Command+K. It's exactly the same as the command for cropping image files, but comes in very useful for some PDFs too.

These days, a lot of official forms can be downloaded and filled in as PDFs. Assuming the files have been created professionally, and have form fields in place, it's ready to be edited quickly in Preview.

From the Tools menu, choose the Text Tool, then just click in one of the form fields and type away. In this mode you can also select contiguous chunks of text for copying to the system-wide clipboard.

Searching a PDF Searching a PDF

The Annotate tool lets you add your own notes to a PDF. There are two kinds of annotation you can make: a simple oval to encircle an item of note, and an equally simple "sticky note" text box into which you type some comments. You might not be able to make edits to the PDF itself, but you can say exactly how you want it changed.

Preview includes an impressively fast search tool, which will find words within even a very large document in seconds (RAM and processor oomph allowing). Powered by Spotlight, it works much like a Finder search, incrementally finding a string of characters as you type them.

Automator Actions

Digital photographers might be interested in some of Preview's standard Automator Actions (which are included as part of Mac OS X Tiger). You can use these actions as part of batch processing to automate mundane tasks such as scaling, rotating, and flipping images. If you have a folder full of JPEGs, for example, that you want to convert to PNGs, don't convert them one by one; rather use the "Change Type of Images" action in Automator to process the entire folder full of files. In the meantime, you can take a break and enjoy a cold drink.

Automator Actions
Automator Actions

Similar types of actions are available in Photoshop 7. CS, and CS2. But many amateur photographers can't afford the professional version of Photoshop. Now with the Preview/Automator tandem in Mac OS X Tiger, you can enjoy automation without the hefty price tag.

Know the Limits, Enjoy the Speed

Despite all these cool (and we suspect little-used) features, Preview does have limitations. While it does an excellent job of displaying large documents fast, it doesn't support all the bells and whistles that some modern PDFs might include. Some of the more fancy interactive PDFs still require Adobe Reader to display as they were intended, which throws a spanner in the concept of a "portable document format."

But Preview's strengths are speed, robustness, and ease-of-use. The way its printing smarts have been integrated into the system, allowing pretty much any document from any application to be previewed for print with ease, and converted to PDF with a couple of clicks, was a piece of very smart design by Apple's developers.

In its youth, PDF had a reputation as a format that only professionals messed with. They created the perfect product, and all we were allowed to do with it with our simple reader applications was, well, read it.

Preview brings simple PDF manipulation to the rest of us, offering a whole bunch of useful features that many users will never have realized they were missing.

Giles Turnbull is a freelance writer and editor. He has been writing on and about the Internet since 1997. He has a web site at http://gilest.org.


Return to MacDevCenter.com.

Copyright © 2009 O'Reilly Media, Inc.