Archive for the 'Digital Imaging' Category

Imaging 101: Adjusting Image Size

Saturday, September 6th, 2008

The previous two posts covered some simple examples that demonstrate the concepts of how images are composed of pixels (the more the merrier), and that pixel size and resolution are closely tied. In this article, I’ll tie these examples to the Image Size dialog in Photoshop, and show how some of the common options affect these characteristics of an image.

Regardless of the version of Photoshop you may be using, the Image Size dialog is pretty much the same across the board. With an image document already open, from the Image menu, choose Image Size…, or press Command-Option-I (PC users: Ctrl-Alt-I). The dialog shown below is from the Mac version of Photoshop CS3, but the features should be the same for your version.

 

I have annotated this screen shot with the yellow letters for reference. The section labeled "A" is obviously telling you the pixel dimensions of the image. My document is 640 pixels wide, and 480 pixels high. The interesting thing to notice at this point is that these values are not editable. You can’t change the pixel dimensions right now, and we’ll find out why in a minute.

Document Size

The section labeled "B" shows you the size of the document, which you’ll recall is a combination of pixel size and resolution. Notice in this example that the resolution is 100 ppi. If you multiply the width of the document (in inches) by the resolution (in pixels per inch), you’ll get the width of the document in pixels; 6.4 x 100 = 640. The same, of course, goes for the height; 4.8 x 100 = 480. The math majors among you will figure out that you can also divide the pixel dimensions by the resolution to get the physical size, or divide the pixels by the size to get the resolution. Changing any one of the three editable values will force the other two to update so that the math always comes out right. This link between the three values is represented on the Image Size dialog by the black connecting bars and the little chain link icon at the right end of the Document Size section of the dialog. The black bars connect the values that are dependent on each other. Whenever you see those connections between values, you’ll know that changing one will automatically change the other(s).

Resample Image

Notice the area of the dialog marked with a "C"—there is a check box labeled "Resample Image." When this box is unchecked, Photoshop will not change the pixel dimensions of your image, so none of the changes we make to the resolution and size values will have any visible impact to the image on the screen. However, the resolution/size values do make a difference when printing the image. The printer driver looks at the resolution to determine how big each pixel will be printed. So, if our image is kept at 100 ppi, it will be printed at 6.4 x 4.8 inches on the paper. If we wanted it to print at half that width and half the height, we could change the resolution to 200 ppi, and the image would print at 3.2 x 2.4 inches. Both images look exactly the same on the screen when viewed at 100% in Photoshop because the number of pixels in the image (pixel dimensions) is constant.

This direct relationship between the document size and the pixel dimensions exists because the pixel dimensions are fixed. But what if the pixel dimensions could change? Changing the total number of pixels in the image is called resampling. In the previous post, Pixel Size and Resolution, we had a fixed size space to fill with a tile design on the bathroom floor, and we saw how changing the size of the tiles affected the quality of the image. Each time we switched to a smaller tile size, that allowed us to fit more tiles into the same physical space. That process was an example of resampling.

In the screen shot below, we’ve checked the Resample Image checkbox.

 

Notice there are now a number of differences worth mentioning. First, the link between the resolution and the width/height is gone. This means that we can change the resolution without changing the width/height. However, there is a new connection (not indicated by a graphical link) between the resolution and the pixel dimensions. If we double the resolution, our pixel dimensions (width and height) both double as well. This is possible because Photoshop is able to resample the image and create new pixels by interpolating between the existing ones.

Another difference to notice is that the width and height fields in the Pixel Dimensions section are now editable, and they are also linked by the black connecting bar with the link icon. Since these fields are editable, we can specify exact pixel dimensions and let Photoshop automatically adjust the document size accordingly. This is useful when you know the exact pixel dimensions required for a particular purpose.

It’s good to be careful with the Resample Image box checked, because there are so many relationships between the editable fields that you can easily change a value unintentionally. The Resolution value is important to watch if your image is intended to be printed, but not so important if you’re targeting the web, or other on-screen purpose. More sophisticated applications, however, will respect the Resolution value stored in an image, so don’t be surprised when you copy a 640×480 image from Photoshop and paste it into a Word document and it shows up as a tiny thumbnail. If this happens, your resolution was probably higher than 72 ppi. If your pixel dimensions are what you want, but your resolution value is too high for your intended target, simply uncheck the Resample Image checkbox and then change the resolution to the desired value. 72 ppi is the expected resolution for all web graphics, and anything you might paste into an email that is not intended to be printed.

Constrain Proportions

The last part of the Image Size dialog I want to mention is the Constrain Proportions checkbox. If you uncheck that box, it removes the links that connect width and height, as shown below.

 

When Constrain Proportions is checked, Photoshop maintains the proportions of your image—it makes sure that a square image remains a square, etc. This is a setting that should normally remain checked, because it’s rare that you want the ability to mess up the proportions of an image. A portrait photo, for example, should not be stretched wider unless the height is maintained proportionally, or else the person would appear to have gained weight.

 

In this example, the original image (left) is 150×150 pixels. If we open the Image Size dialog and check the Resample box and the Constrain box, and then change the document height to 100, we’d get the middle image. Photoshop constrained the dimensions so that when I reduced the height, the width was automatically reduced by the same percentage. This is the desired result. If we did the same thing again, but this time we left the Constrain box unchecked, our resulting image would be like the third one above—clearly NOT what we want, as the Moon now looks squashed.

This is the effect that’s now very common on the new wide-screen TVs that fill their available width by stretching the image that was meant for a narrower screen. Unless you want the freedom to distort your image in unnatural ways, keep the Constrain Proportions box checked.

Sometimes you think you may really need to change the proportions, and you’ll be tempted to uncheck the Constrain box just to get what you need. For example, say you have a portrait photo shot on a digital SLR, and the aspect ratio is 2:3. With the Constrain Proportions box checked, this photo will easily size to 4×6, or 12×18, or any other size that has a 2:3 aspect ratio. However, what you really want to print is an 8×10. If you unchecked the Constrain box and scaled it to 8×10, the proportions would be out of whack, your portrait is going to get squashed, and your subject will not be pleased. Instead, leave the Constrain box checked, scale the image to 8×12, and then use the Crop tool to crop 2 inches of height from the top and/or bottom of the portrait, leaving you a nice, well-proportioned 8×10.

The Constrain Proportions check box is your friend—leave it checked when resampling images.

Imaging 101: Pixel Size and Resolution

Tuesday, September 2nd, 2008

In the last post, we looked at how the level of detail in an image is directly related to the number of pixels, and we compared some images made from equal-sized pixels. For a given output device (e.g., video display), the pixels are usually the same size, and would only change if you changed the resolution of your monitor—more on this later. Just understand that the size of the individual pixels is generally a constant for any given display device.

But what about different devices? Have you ever used a friend’s computer to view a familiar web site and noticed that the site (layout, graphics, text, etc.) looked a little bigger or smaller than you were used to? If so, that’s because the pixels on your monitor are larger or smaller than the pixels on your friend’s monitor. In other words, the two monitors have different resolutions.

The resolution of a particular device is measured in dots-per-inch (dpi), or pixels-per-inch (ppi). If a monitor has a native resolution of 96 ppi, that means that you could count (if you had really sharp eyes) 96 pixels in one inch of a single row or column of pixels. If that monitor’s display was 10 inches wide and 7.5 inches high, the image size would be 960 x 720 pixels (pixels = inches x ppi).

Floor Tile Example

Let’s look at a detailed example. Imagine that you want to design a mosaic tile image of Mickey Mouse to install for the kids on their bathroom floor using square tiles in only 8 custom colors.

Here are the eight custom tile colors you’ll use:

Let’s say the space available on the bathroom floor is 2 feet by 1.5 feet (24 x 18 inches), and your tiles that you plan on installing are 1″ squares. In this example, each tile is a pixel because it’s the smallest individual element of the picture. Your image would have a resolution of 1 ppi because every row of tiles would have one tile per inch. That’s 12 tiles per foot, so your pixel dimensions are 24 x 18 tiles. At that resolution, your bathroom floor would look something like this:

Yes, it’s kind of a rough look, and that’s what we call “pixellated,” because every individual pixel is very large and obvious. But what if, instead of 1″ square tiles, we could order 1/2″ square tiles. Now, our image would have twice the number of tiles (pixels) in each row, and twice the number in each column. The new resolution would be 2 ppi, with pixel dimensions of 48 x 36 tiles, and we’re using a total of 4 times as many tiles as before. Our new image would look like this:

That’s certainly better, but what do we notice about the two images? They are both 2 feet wide and 18 inches high, but one has pixels that are half the size of the other’s, and it has twice as many in each row and column. The resolution of one is twice that of the other, and the difference is clearly visible as a higher quality image.

Now, what if we were to find some really small tiles? Let’s say we found a supplier who would sell us 1/5-inch tiles and 1/10-inch tiles. They would be tedious to install, but they would increase our resolution to 5 ppi and 10 ppi, respectively. To fill the same space on our floor, we’d have to use a lot more tiles, so our pixel dimensions would be 120 x 90 (at 5 ppi) and 240 x 180 (at 10 ppi), and the images would look like this:

This demonstrates that two similar images of the same physical size can have differing quality based on the size of the pixels (resolution). We saw in the last post, and demonstrated again in this example, that an image with more pixels has higher quality than one with fewer pixels. If the physical size of an image is to remain the same, its pixel dimensions (width and height in pixels) can increase only if the pixels get smaller. Smaller pixels mean higher resolution (measured in PPI or DPI), and a higher resolution yields better image quality.

This concept is particularly important when preparing images for printing, as we’ll examine in the next post.

Imaging 101: Pixel Dimensions

Saturday, April 19th, 2008

Over the years, I’ve been asked many times about a topic that seems simple to those of us who do a lot of image manipulation, but remains a challenge to explain to the novice. So, I’m going to take a stab at it, and if I can conjure up a decent explanation, then I’ll have a place to send people who ask in the future. The general question is about the relationships between document size, resolution (ppi or dpi), and pixel dimensions. You see? It already sounds confusing—I’ve got my work cut out for me.

Because this is a fairly broad topic (and because I can think of many different examples to illustrate it), I will be breaking the explanations down into separate posts. Hopefully by the time I’m finished, it will all fit together and make perfect sense. To get started, I’ll cover the basics of a digital image.

Digital Imaging Basics

For this series of posts, I will be discussing what we call “bitmapped” images. This simply means that the image is made up of a grid of dots, and this applies to all digital photos. Adobe Photoshop is a bitmapped image editor. The other kind of image (non-bitmapped) is called a “vector” image, and Adobe Illustrator is an example of a vector image editor.

The smallest element of any bitmapped digital image is the pixel (a loose abbreviation for Picture Element), which appears as a single colored dot on the screen.  An image is composed of a grid of pixels with a certain number of rows and columns. Back in the ’80s, early IBM PCs were sold with a video card called a “versatile graphics adapter,” or VGA. This card was designed to drive a color display with 480 rows of pixels, with 640 pixels in each row. Today, video cards are much more advanced, but we still sometimes use the acronym VGA to refer to those pixel dimensions (640×480).

A digital photo, or any other digital image, can be any size you want, but they all have a rectangular grid of pixels (including any transparent pixels). The more pixels the image contains, the more detail you can see. Icons that appear on a Windows desktop are typically 32 rows of 32 pixels. These can be referred to as 32×32-pixel images. Images taken on a 2MP (MegaPixel) iPhone camera are 1600×1200 pixels. Images from my 10MP Canon 40D are 3892×2586 pixels. If you ignore all other aspects of document size and resolution and assume that all pixels are the same size, it should be clear that the fundamental rule of digital images is that an image with more pixels will be larger and more detailed than others with fewer pixels. Here is a small image represented by four different pixel dimensions.

In each of these four images, the pixels are all exactly the same size (determined by your video monitor), but each image uses a different number of them. The more pixels an image has, the more detail you can see in the image.

The next post will discuss pixel size and what happens when the pixels are not all the same size.