Web DevCenter    
 Published on Web DevCenter (http://www.oreillynet.com/javascript/)
 See this if you're having trouble printing code examples


Resizing an Image

by Deke McClelland, author of Adobe Photoshop CS One-on-One
03/30/2004

Author's note: To understand Photoshop--to really understand Photoshop--you have to come to terms with pixels. Those tiny squares of color are the alpha and omega of imaging. If this were biology class, they would be the little beings that combine to form the greater organism, and you would be in charge of managing their population. Given that their numbers more often than not swell into the millions, your concern has less to do with their individual condition and more to do with their combined effect and, perhaps most importantly, their shockingly vast quantity. Just how many pixels does your image contain and how many do you really need?

Pixel population is one of the most fundamental and least understood aspects of image editing. If you’re not clear on how to put them to proper use, concepts like image size, resampling, and resolution may loom as impassible roadblocks between you and a creative Photoshop experience.

That’s why I’m here. Lifted from the drop-dead gorgeous, full-color pages of Adobe Photoshop CS One-on-One, the following hands-on exercise explains how to modify image size, when to resample, and what in the world you should do about resolution.

And just to make things crystal clear, I’m also including one of the QuickTime-based video lessons that make the book absolutely unique, an 8-minute 39-second ditty I call Image and Canvas Size. The full video is quite big (about 26MB); if you’re not interested in a long download, check out the 1-minute excerpt instead. Bear in mind, both videos require that Apple’s QuickTime be installed on your machine. If you don’t have QuickTime, click here.

With that, I invite you to enjoy "Resizing an Image." It may just be the most fun you’ve had with a 21-foot-tall rocking chair in all your life.

Resizing an Image

Now we leave the world of rotations and canvas manipulations in favor of what may be the single most essential command in all of Photoshop: Image -> Image Size. Designed to resize an entire image all at once—canvas, pixels, the whole shebang—Image Size lets you scale your artwork in two very different ways. First, you can change the physical dimensions of an image by adding or deleting pixels, a process called resampling. Second, you can leave the quantity of pixels unchanged and instead focus on the print resolution, which is the number of pixels that print within an inch or millimeter of page space.

Pearl of Wisdom

Contrary to what you might reasonably think, print resolution is measured in linear units, not square units. For example, if you print an image with a resolution of 300 pixels per inch (ppi for short), then 300 pixels fit in a row, side-by-side, an inch wide. In contrast, a square inch of this printed image would contain 300 x 300 = 90,000 pixels, and why say "90,000 ppsi" when "300 ppi" is so much easier? Also note that the print resolution, ppi, is measured separately from the hardware resolution, dpi (short for dots per inch), which we'll explore in Lesson 12, "Printing and Output."

Whether you resample an image or change its resolution depends on the setting of a check box called Resample Image. As we'll see, this one option has such a profound effect on Image Size that it effectively divides the command into two separate functions. In this next exercise, we explore how and why you might resample an image. To learn about print resolution, read the "Changing the Print Size" sidebar on page 154.

1. Display the status bar. If you're working on a PC, make sure the status bar is visible at the bottom of the screen. If it isn't, choose WindowStatus Bar. (Macintosh users can skip this step.)

2. Open the image you want to resize. Open the file named EnormousChair.jpg (1.7MB file). Shown in Figure 5-33, this 21-foot-tall rocking chair is not only enormous in real life, but also contains the most pixels of any file we've seen so far (not including layers).

3. Check the existing image size. To see just how many pixels make up the image, press the Alt key (Option on the Mac) and click the box that lists the size of the image file in megabytes, Doc: 17.5M/17.5M. This box is located on the left side of the status bar, or in the lower-left corner of the image window on the Mac.

Figure 5-33
Figure 5-33.

Pearl of Wisdom

Alt-clicking the box displays a flyout menu that lists the size of the image in pixels, along with its resolution. Pictured in Figure 5-33 on the preceding page, the image measures 2,250 pixels wide by 2,720 pixels tall, for a total of 2,250 x 2,720 = 6.12 million pixels. When printed at 300 ppi, the image will measure 7.5 inches wide by a little more than 9 inches tall.

4. Magnify the image to the 100 percent zoom ratio. Double-click the zoom tool icon in the toolbox. Then scroll around until you can see the sign tacked to the front of the chair. Pictured in Figure 5-34, the text on the sign is exceedingly legible—explaining the whats and the whens of the rocking chair, while inexplicably omitting the whys—a testament to the high resolution of the photograph. But there's also a lot of noise (see Step 8 of the "Correcting Camera Raw" exercise, Lesson 3, page 86). So even though we have scads of pixels, they aren't necessarily in great shape.

Figure 5-34
Figure 5-34.

5. Decide whether all these pixels are really necessary. This may seem like a rather cerebral step, but it's an important one. Resampling amounts to rewriting every pixel in your image, so weigh your options before you plow ahead.

Pearl of Wisdom

In this case, the image contains 6.12 million pixels, just sufficient to convey crisp edges and fragile details such as the text on the sign. But these pixels come at a price. Lots of pixels consume lots of space in memory and on your hard drive, plus they take longer to transmit, whether to a printer or via email or the Web.

So let's say you want to email this image to a couple of friends. Your friends may want to print the photo, but surely they can print it smaller than 7.5 by 9 inches or at a lower resolution. But chances are they won't print the image at all; they'll just view it on screen. A high-resolution monitor can display 1,600 by 1,200 pixels, a mere 30 percent of the pixels in this photo. Conclusion: Resampling is warranted. This is a job for Image Size.

6. Choose the Image Size command. Choose ImageImage Size. Alternatively, if you loaded my shortcuts as suggested on page xvii of the Preface, you can access the command from the keyboard by pressing Ctrl+Alt+I (.-Option-I on the Mac). Pictured in Figure 5-35, the ensuing Image Size dialog box is divided into two parts:

7. Turn on the Resample Image check box. Located at the bottom of the dialog box, this option permits you to change the number of pixels in an image.

8. Select an interpolation setting. To the right of the Resample Image check box is a pop-up menu of interpolation options, which determine how Photoshop blends the existing pixels in your image to create new ones. When downsampling an image, only three options matter:

Because this particular image contains so much noise, Bicubic Smoother is the best choice.

Figure 5-35
Figure 5-35.

Figure 5-36
Figure 5-36.

Changing the Print Size

As often as not, you have no desire to change the number of pixels in an image; you just want to change how it looks on the printed page. By focusing exclusively on the resolution, you can print an image larger or smaller without adding or subtracting so much as a single pixel.

For example, let's say you want to scale the original Enormous chair.jpg image so that it prints 10 inches wide by 12 inches tall. Would you upsample the image and thereby add pixels to it? Absolutely not. The Image Size command can't add detail to an image; it just averages existing pixels. So upsampling adds complexity without improving the quality. There are times when upsampling is helpful—when matching the resolution of one image to another, for example—but they are few and far between.

The better solution is to modify the print resolution. Try this: Open the original Enormous chair.jpg. (This assumes that you have completed the "Resizing an Image" exercise and saved the results of that exercise under a different filename, as directed by Step 15 on page 156.) Then choose ImageImage Size and turn off the Resample Image check box.

Notice that the Pixel Dimensions options are now dimmed and a link icon ( ) joins the three Document Size values, as in the screen shot below. This tells you that it doesn't matter which value you edit or in what order. Any change you make to one value affects the other two, so you can't help but edit all three values at once. For example, change the Width value to 10 inches. As you do, Photoshop automatically updates the Height and Resolution values to 12.089 inches and 225 ppi, respectively. So there's no need to calculate the resolution value that will get you a desired set of dimensions; just enter one of the dimensions and Photoshop does the math for you.

Click OK to accept your changes. You will notice that the image looks exactly the same as it did before you entered the Image Size dialog box. This is because you changed the way the image prints, which has nothing to do with the way it looks on screen. If you like, feel free to save over the original file. You haven't changed the structure of the image; you just added a bit of sizing data.

To learn more about printing—including how you can further modify the print resolution using the Print with Preview command—consult Lesson 12, "Printing and Output."

9. Turn on the Constrain Proportions check box. Unless you want to stretch or squish your image, leave this option turned on. That way, the relationship between the width and height of the image—known as the aspect ratio—will remain constant.

Related Reading

Adobe Photoshop CS One-on-One
By Deke McClelland

10. Specify a Resolution value. When Resample Image is checked (Step 7), any change made to the Resolution value affects the Pixel Dimensions values as well. So if you intend to print the image, it's a good idea to get the Resolution setting out of the way first. Given that we're emailing the image and we're not sure if it'll ever see a printer, a Resolution of 200 ppi should work well enough.

11. Adjust the Width or Height value. The Pixel Dimensions have dropped to 1,500 by 1,813 pixels. But given that most screens top out at 1,600 by 1,200 pixels, that's still too big. Reduce the Width value to 900 pixels, which changes the Height value to 1,088 pixels. This also reduces the Document Size to 4.5 by 5.44 inches (see Figure 5-36), plenty big for an email picture.

12. Note the new file size. The Pixel Dimensions header should now read 2.80M (was 17.5M), where the M stands for megabytes. This represents the size of the image in your computer's memory. The resampled image will measure 900 x 1,088 = 979,200 pixels, a mere 16 percent of its previous size. Not coincidentally, 2.8M is precisely 16 percent of 17.5M. The complexity of a file is directly related to its image size, so this downsampled version will load, save, print, and email much more quickly.

13. Click OK. Photoshop reduces the size of the image on screen and in memory. As verified by Figure 5-37, the result continues to look great when printed, but that's in part because it's printed so small. The real test is how it looks on your screen.

Figure 5-37
Figure 5-37.

14. Magnify the image to the 300 percent zoom ratio. Use the zoom tool to zoom in on the sign, as in Figure 5-38. The letters are rougher—no surprise given the lower number of pixels— but they remain legible. And the photo overall is less grainy. Downsampling with the Bicubic Smoother setting (Step 8, page 153) goes a long away toward smoothing away the noise.

Figure 5-38
Figure 5-38.

15. Choose File -> Save As. Or press Ctrl+Shift+S (.-Shift-S on the Mac). Then give the file a new name or save it to a different location. The reason I have you do this is to emphasize the following very important point:

Pearl of Wisdom

At all costs, you want to avoid saving your downsampled version of the image over the original. Always keep that original in a safe place. I don't care how much better you think the downsampled image looks; the fact remains, it contains fewer pixels and therefore less information. The high-resolution original may contain some bit of detail you'll want to retrieve later, and that makes it worth preserving.


Just in case you missed the video download links at the start of the excerpt, here they are again: the full video clip, and the 1-minute video clip.

Deke McClelland is an electronic publishing pioneer and a popular lecturer on Adobe Photoshop and the larger realm of computer graphics and design. He has hosted Adobe's official "Video Workshop" DVDs that shipped with many versions of Photoshop and Illustrator, as well as hundreds of hours of tutorial-style video training for industry leader lynda.com, with whom his work has won a record-setting eight international awards in the last 12 months. In addition to his video work, Deke has written over 80 books translated into 24 languages, with more than 4 million copies in print. In 2004, Deke created the bestselling One-on-One book series. Published with O'Reilly Media, One-on-One uses video, step-by-step exercises, and hundreds of full-color illustrations to provide readers with the closest thing possible to private instruction from a recognized expert.


O'Reilly & Associates just released (February 2004) Adobe Photoshop CS One-on-One.

Return to the Web Development DevCenter.

Copyright © 2009 O'Reilly Media, Inc.