In “The Power of Preview: Pulling Files into Preview” (25 February 2016) and “The Power of Preview: Viewing Images and PDFs” (13 March 2016), we walked you through the basics of opening and viewing files in Preview, OS X’s venerable, all-purpose document and image viewer. This time, we begin digging into Preview’s image manipulation capabilities.
As writers of technical articles and books, we work with screenshots constantly, and Preview saves us time over using more full-featured tools like Pixelmator or Photoshop, thanks to Preview’s focused tool set. You can even take screenshots from within Preview itself, as noted in “The Power of Preview: Pulling Files into Preview”.
The most common tasks we perform when editing screenshots are cropping and resizing, to cut out unneeded elements and keep images from being too large. Preview excels at both of these tasks.
Cropping Images with Preview -- To crop an image means to remove everything outside of a selected area, and Preview makes that easy. But first, you have to understand how to use its Rectangular Selection tool.
The Rectangular Selection tool should be the default when viewing images, but if you need to activate it, choose Tools > Rectangular Selection. It’s also available on the far left of the Markup Toolbar, which you can display by choosing View > Show Markup Toolbar (Command-Shift-A).
Using the Rectangular Selection tool is simple: just click and drag to create a selection box. You can move the selection box by positioning your cursor inside the box so it becomes a hand — after that, click and drag to move the box. Likewise, you can click and drag the blue circles to adjust the size of the box. As you adjust the size of the box, its pixel dimensions are displayed in a small popover, a handy aid.
In the example screenshot, we want to crop out everything but the Finder and Preview windows. Once the selection box is over the windows, select Tools > Crop (Command-K) to cut out everything that’s not wanted.
That’s not hard, but here’s a technique that simplifies creating precise crops around windows, dialogs, and other objects.
First, don’t attempt to make a precise selection, since that can be tricky. Instead, drag out a rough selection around the desired object that includes some of the background, and then press Command-K to make an initial crop.
Then use the blue handles in the middle of each side of the selection rectangle to move each side in to exactly the desired position before cropping again. That requires four actions, but can be more precise than using the corner handles, which resize the selection in two dimensions at once. It can be hard to get both sides exactly right at the same time.
If you’re cropping a very small object, such as the buttons we use as inline graphics in Take Control books, after making that initial rough crop, zoom in closely so you can see the object’s exact edges before dragging the side handles in to make your final selection and then cropping. For zooming instructions, refer back to “The Power of Preview: Viewing Images and PDFs.”
Here’s a final tip to remind you of a feature we mentioned in “The Power of Preview: Pulling Files into Preview.” If you make a rectangular selection, instead of cropping, you can copy the selection and then choose File > New from Clipboard to create a new document containing the copied data. In other words, a selection followed by Command-C and Command-N is a quick way to get a new file containing your desired content — it’s another path to a cropped image that might be more appropriate in certain workflows.
We’ve focused on images here, but you can also crop PDFs using the same method. This is rarely useful, and note that Preview crops only a single page at a time. Plus, since Preview doesn’t actually delete content, but instead just hides it, the PDF will likely appear uncropped in other apps. Preview even warns you of this fact.
Resizing Images with Preview -- You’ve cropped out the parts of the image you don’t need, but it’s still too large, either in terms of dimensions or file size? Again, Preview makes it easy to shrink the image.
Choose Tools > Adjust Size and a handy dialog appears. Play with the settings and either click OK to apply your changes or Cancel to back out. Here’s a quick overview of what each of the controls does:
Fit Into: This dropdown menu gives you a set of predefined sizes to fit the image into. These sizes match common screen sizes, and are most useful for making wallpaper images. If your image doesn’t match the aspect ratio of the pre-defined size you choose, Preview fits the longest side of your image to the appropriate dimension. So a portrait image will always be fit to the height of the pre-defined size, and landscape images will be fit to the width. When you adjust the width and height yourself, this menu sets itself to Custom; you don’t need to choose that manually.
Width and Height: In these fields, you can manually set the width and height of the image. The pop-up menu on the right lets you set the unit of measurement: pixels, percent, inches, centimeters, millimeters, or points. Which of these you choose depends mostly on how you think about your output.
If you’re planning to use the image on a Web site, pixels likely makes the most sense, whereas if it’s destined for a printed document, a real-world measurement like inches, centimeters, or millimeters may be more helpful. If the actual size doesn’t matter too much, you can shrink it by a percentage.
One tip that applies to all image editing: you can always scale images down, but you don’t want to scale images up. Unlike what you may see on TV shows, scaling an image up almost never works well, because Preview has to generate pixels out of thin air, and the resulting image is always blurry.
Resolution: Here you can adjust the resolution of the image, in either pixels per inch or pixels per centimeter. Resolution is a tricky topic, but in short, for images destined for the screen, it’s usually irrelevant and can be ignored. For screen display, all you care about is how many pixels the image has — whether it’s 72 ppi or 144 ppi should make no difference in how it looks onscreen. Don’t assume that reducing the resolution will make the file size smaller either; it will if you select Resample Image because you’re throwing away pixels, but if you don’t resample the image, the file size will stay roughly the same and may even increase somewhat for JPEGs.
For images you want to print, resolution is important to know. If you have a 72 ppi image, it will need a lot more pixels to print at a decent size on paper than if it’s a 300 ppi image. But you can’t change the resolution to get better results because any change in resolution must either throw pixels away or add pixels in, neither of which is good for the image. In short, unless you know what you’re doing, leave the resolution setting alone. For a good discussion of resolution, see the Photoshop Essentials site’s explanation.
Scale Proportionally: In nearly all cases, leave Scale Proportionally selected, because otherwise your image will be stretched or squished in the dimensions that change.
Resample Image: As noted above, resampling changes the number of pixels in the image. Thus, it should be selected in most situations, particularly when the image is destined to be displayed on a screen, where you want to control the pixel dimensions. And in fact, if you deselect Resample Image, you can no longer choose pixels in the pop-up menu next to Width and Height, Scale Proportionally is locked on (since disproportionate scaling would change the number of pixels), and any changes you make in Width and Height also change Resolution. All you can do then is change how large the image will print. Again, Photoshop Essentials has a nice explanation.
Resulting Size: This feedback area is useful to watch, particularly if you’re trying to reduce the file size of your image. As you adjust the image’s pixel dimensions, it tells you the resulting percentage size of the original image, the resulting file size, and the previous file size. Changing resolution while resampling doesn’t affect size much, and Preview doesn’t report on such changes.
It’s extremely easy to get confused when playing with image size settings because Preview honors the physical dimensions (which are based in part on resolution) when displaying images and attempts to open all images at actual size. In our discussion of Preview’s preferences in “The Power of Preview: Viewing Images and PDFs,” we said that we had no idea why you’d choose between 1 Image Pixel Equals 1 Screen Pixel and Size on Screen Equals Size on Printout for Define 100% Scale As. Now we understand. When you see “100%,” think “Actual Size.”
If you’re working with images primarily for display on screen, such as on Web pages, it’s probably most sensible to choose 1 Image Pixel Equals 1 Screen Pixel. That way, if you open a 1920-by-1280 image that’s 300 ppi, Preview displays it at its actual size in pixels. A 1920-by-1280 image that’s only 72 ppi opens at exactly the same size. That’s what you’d expect, since resolution isn’t relevant to publishing on screen.
However, if most of your image work is destined for print, selecting Screen Equals Size on Printout may be helpful, since then, assuming the same pixel dimensions, a higher-resolution image appears smaller and a lower-resolution image appears larger, just as would happen on a printout. In that case, Preview displays the 300 ppi image at a much smaller size than the 72 ppi image when both are at actual size.
The problem with Preview honoring the resolution-dependent physical dimensions is that other graphics programs, like Graphic Converter, focus only on pixel dimensions. If you work in other graphics apps too, Preview may confuse you by displaying the same image differently. So don’t get too wrapped up in how something looks in Preview; just focus on the pixel dimensions for screen-destined images.
Undoing It All -- The safest approach when editing an image is to make a copy before modifying it, but it’s easy to forget to do that. In that case, you have two ways to undo unwanted changes.
The first is the hoary Edit > Undo (Command-Z) command, which lets you undo recent actions. There’s also Edit > Redo (Command-Shift-Z), which lets you redo actions that you’ve undone. Nothing new there.
But if you’ve already saved and closed a file, and later reopened it, you can’t use the Undo command. Thankfully, you can still revert to an older version, thanks to Preview’s support for the Modern Document Model (see “The Very Model of a Modern Mountain Lion Document,” 7 August 2012). Choose File > Revert To, where you see two options: Last Opened and Browse All Versions. Last Opened reverts all changes made to the file since you last opened it.
Browse All Versions displays a Time Machine-like interface, with the current version of the document on the left and previous versions on the right. Use the arrow buttons to move between versions — unfortunately, it’s usually impossible to discern the differences between versions that have just been resized, so you may have to guess based on the timestamp. Click Restore to restore the file to the version showing on the right, or click Done to cancel.
We’ve barely touched the modifications you can make to documents and images in Preview, but this article lays the groundwork for future exploration. You now understand how to select parts of a file and undo unwanted changes. Next, we’ll dig deeper into Preview’s image-editing power.