Sub topic 2
Pixel Dimensions: The Real Size of an Image
This chapter assumes you can open, save, and export files in Photoshop, know what the Layers panel does, and know that a pixel is one colored square in an image. It covers pixel dimensions, which are the one size measurement that describes the actual data in a raster file. Later chapters build resolution and print size on top of it.
What pixel dimensions are
A raster image is a grid of pixels. Each pixel stores one color value. The pixel dimensions of the image are the number of columns (width) and the number of rows (height) in that grid. A photo that is 4000 px wide and 3000 px tall holds 4000 × 3000 = 12,000,000 pixels, or 12 megapixels.
Pixel dimensions are the real size of an image because they describe how much information the file contains. Inches, centimeters, and ppi values only describe how that information is spread across a page or a screen. If you change those values without touching the grid, no detail is added or lost.
| Property | What it measures | Changes the data? |
|---|---|---|
| Pixel dimensions | Columns and rows of pixels | Yes |
| Resolution (ppi) | Pixels per inch when printed | No, it is a label |
| Document size | Pixel dimensions divided by resolution | No, it is derived |
A screen shows an image by mapping pixels to its own physical pixels. A browser displaying a 1200 px wide image at 100% zoom uses 1200 screen pixels for it, regardless of any ppi value saved in the file. This is why pixel dimensions are the number that matters for web work.
Reading pixel dimensions in Photoshop
You can find the pixel dimensions of the open document in several places:
- Image > Image Size (Alt+Ctrl+I on Windows, Option+Cmd+I on macOS). The Image Size line at the top shows the file size in memory, and the Dimensions line shows width × height. Click the unit menu beside Dimensions and choose Pixels if it shows another unit.
- The status bar at the bottom of the document window. Open its menu and choose Document Dimensions to see the size in the unit set in your preferences. You can also hold the mouse button on the status bar field to see a preview of the document's width, height, channels, and resolution.
- Image > Canvas Size. The Current Size section shows width and height in the units you choose.
- The Info panel and the rulers. Set the ruler units to pixels in Preferences > Units & Rulers so that measurements match the grid.
Check the unit menu every time. The same document can read "10 in", "25.4 cm", or "3000 px" depending on the unit selected, and typing a number into a field with the wrong unit is one of the most common sizing mistakes.
The arithmetic of pixel dimensions
Three quantities are linked by one relationship:
pixels = inches x ppi
3000 px / 300 ppi = 10 in
3000 px / 150 ppi = 20 in
6 in x 4 in at 300 ppi = 1800 x 1200 pxYou can use it in three directions:
- To find the pixels you need, multiply the print size by the resolution. A 6 × 4 in print at 300 ppi needs 1800 × 1200 px.
- To find the print size an image supports, divide pixels by ppi. A 3000 px wide image prints 10 in wide at 300 ppi.
- To find the effective resolution of an image placed at a given size, divide pixels by inches. A 3000 px image stretched to 20 in is 150 ppi.
Aspect ratio is the width divided by the height. A 1800 × 1200 image has a ratio of 1.5, written 3:2. Changing only one dimension changes the ratio and stretches or squashes the content. The Image Size dialog keeps the ratio by default with a link (chain) icon between the width and height fields. Turn the link off only when you want a different ratio and accept the distortion.
File size follows pixel count
Pixel count drives how much memory an open image uses. An RGB image with 8 bits per channel uses 3 bytes per pixel, so the uncompressed size is:
def uncompressed_bytes(width_px, height_px, channels=3, bits_per_channel=8):
return width_px * height_px * channels * bits_per_channel // 8
size = uncompressed_bytes(4000, 3000)
print(size) # 36000000
print(round(size / 1024**2, 1)) # 34.3A 4000 × 3000 RGB image therefore takes about 34.3 MB in memory. Doubling both dimensions quadruples the pixel count and the memory, because area grows with the square of the side. A 16-bit image doubles the figure again, and each extra layer adds its own pixel data.
The saved file is usually smaller than this because formats such as JPEG, PNG, and PSD compress the data. How much smaller depends on the format and the content, so do not use the in-memory figure to predict a download size. Use it to judge how heavy a document will be to edit.
Pixel dimensions on screen and on paper
The same pixel grid reaches the viewer through different paths.
- Screen. Pixel dimensions decide how the image appears. A 1200 px image on a standard display fills 1200 device pixels at 100% zoom. On a high-density display (often called Retina or HiDPI), the operating system uses two or more device pixels per layout pixel, so a 1200 px wide image occupies only 600 layout units and looks soft unless you supply a larger file, for example 2400 px wide.
- Print. A printer needs enough pixels to cover the paper at its target ppi. The same grid is stretched or compressed to fit the paper by changing the resolution value.
- Photoshop zoom. The zoom level in the title bar compares image pixels to screen pixels. At 100%, one image pixel equals one screen pixel. At 50%, Photoshop shows a downsampled preview. The file is unchanged. View > Actual Pixels returns to 100%.
What changes pixel dimensions and what does not
Many commands feel like resizing but only some alter the grid. Knowing which is which lets you predict the result before you apply it.
| Action | Pixel dimensions | Pixel data |
|---|---|---|
| Image Size with Resample off, change resolution | Unchanged | Unchanged |
| Image Size with Resample on, change width or height in pixels | Changed | Recalculated (pixels added or removed) |
| Canvas Size larger | Changed | Original pixels kept, new empty area added |
| Canvas Size smaller | Changed | Pixels outside the new canvas are cut away |
| Crop tool | Changed | Pixels outside the crop are removed or hidden |
| Zooming in the document window | Unchanged | Unchanged |
Two of these deserve detail, because they are covered fully in later chapters but affect how you read pixel dimensions now.
Resample off. The Image Size dialog has a Resample checkbox. With it off, the pixel dimensions are locked. Changing the resolution then changes only the printed size, and changing the width in inches changes only the resolution. Nothing in the grid is touched.
Resample on. With it on, you can type new pixel dimensions. Photoshop must then invent pixels (upsampling) or discard them (downsampling). Invented pixels are estimates calculated from their neighbors, so they add no real detail. Discarded pixels are gone for good once you save.
Edge cases and common errors
- A high ppi number does not mean a large image. A 300 × 200 px image set to 600 ppi is still a tiny image that prints 0.5 in wide. Always check the pixel dimensions first.
- A low ppi number does not mean a small image. A 6000 px wide photo saved at 72 ppi is large. It prints 83.3 in wide at 72 ppi, and it prints 20 in wide at 300 ppi with no change to the pixels.
- Fractional results. Pixel dimensions are whole numbers. If a calculation gives 1349.6 px, Photoshop rounds it, and the aspect ratio shifts by a tiny amount. When exact ratios matter, choose pixel dimensions that divide evenly.
- Wrong unit in a field. Typing 1200 into a field set to inches asks for a 1200 in wide image. Photoshop warns you or produces an enormous document, so confirm the unit menu before you type.
- Zoom is not size. A document that looks small at 25% zoom has the same pixel dimensions as it did at 100%.
- Metadata can disagree with reality. A file can carry a ppi value copied from a camera or another application. Treat it as a suggestion and decide the final value yourself.
- Enlarging does not recover detail. Going from 1000 px to 3000 px produces a larger file with the same amount of real information, usually softer to the eye.
Setting up pixel dimensions in a script
You can also read and set pixel dimensions with ExtendScript. This script reports the active document's size in pixels, then reports how large it prints at 300 ppi.
// Photoshop ExtendScript (.jsx)
app.preferences.rulerUnits = Units.PIXELS;
var doc = app.activeDocument;
var w = doc.width.value;
var h = doc.height.value;
var megapixels = (w * h / 1000000).toFixed(1);
var printW = (w / 300).toFixed(1);
var printH = (h / 300).toFixed(1);
alert(
"Pixel dimensions: " + w + " x " + h + " px\n" +
"Megapixels: " + megapixels + "\n" +
"Prints " + printW + " x " + printH + " in at 300 ppi"
);Setting rulerUnits to pixels first matters. If the preference is left on inches, doc.width.value returns inches and every calculation after it is wrong. Resizing the grid itself is a separate job covered in the scripting chapter.
A worked example
You receive a photo that is 4800 × 3200 px and need a print of 8 × 10 in at 300 ppi, plus a web version 1200 px wide.
- Print requirement: 8 in × 300 = 2400 px and 10 in × 300 = 3000 px. The photo ratio is 3:2 (1.5) and the print ratio is 5:4 (1.25), so they differ.
- Fit the height first. The photo is 3200 px tall, which exceeds 2400 px. At 300 ppi, the print's short side of 8 in needs 2400 px, so a crop of 4000 × 3200 px in 5:4 gives 10 in × 8 in with room to spare. A crop is the right tool, because resizing would distort the picture.
- The cropped area of 4000 × 3200 px at 300 ppi prints 13.3 × 10.7 in, which is larger than the 10 × 8 in needed. You can downsample slightly or simply set the crop to 3000 × 2400 px.
- Web version: the height for a 1200 px wide copy of the 3:2 photo is 1200 × 3200 / 4800 = 800 px. The final size is 1200 × 800 px.
The arithmetic tells you what is possible before you open any dialog. The photo has more pixels than the print needs, so no upsampling is required.
Exercise
A scan is 2400 × 1800 px and is labeled 300 ppi. (a) How large does it print in inches? (b) You set Resample off and change the resolution to 200 ppi. What are the new print size and pixel dimensions? (c) How many pixels would you need for a 12 × 9 in print at 300 ppi?
Show answer
(a) 2400 / 300 = 8 in wide and 1800 / 300 = 6 in tall, so 8 × 6 in. (b) The pixel dimensions stay 2400 × 1800 px. The print size becomes 2400 / 200 = 12 in by 1800 / 200 = 9 in. (c) 12 × 300 = 3600 px and 9 × 300 = 2700 px, so 3600 × 2700 px. The scan is short of that, so reaching it would require upsampling, which adds no real detail.
Exercise
A 4000 × 3000 px RGB image at 8 bits per channel uses about 34.3 MB in memory. Roughly how much memory does the same image use after you resample it to 2000 × 1500 px? Explain why the answer is not half.
Show answer
About 8.6 MB. Memory depends on the pixel count, which is width × height. Halving both sides leaves one quarter of the pixels (2000 × 1500 = 3,000,000 versus 12,000,000), so memory falls to one quarter: 3,000,000 × 3 bytes is 9,000,000 bytes, or about 8.6 MB.