Image size explained: pixels, DPI, file size and quality
“Make the image smaller” can mean three different things: fewer pixels, a smaller printed size, or fewer bytes in the file. They are linked, but changing one does not always change the others, which is why an image can look sharp on a phone and blurry on paper, or weigh 5 MB while looking no better than a 300 KB copy.
This guide separates the three, explains what the DPI and quality settings really do, and backs the advice with measurements: we encoded the same 1280 × 854 photo of a riverside street at different sizes and qualities in Chrome, the engine the nTools resizer uses, and compared the results with the original.
Three sizes that are easy to mix up
- Pixel dimensions: how many dots the image is made of, such as 4032 × 3024. This is the only size that decides how much detail there is.
- Print size: how large the picture comes out on paper. It is the pixels divided by a density, written as DPI or PPI (dots or pixels per inch).
- File size: how many bytes the file takes, such as 2.4 MB. It depends on the pixels, the format and the compression quality.
Most problems come from changing one of these while expecting another to follow: raising the DPI to make a print sharper, or lowering the quality to fix a photo that is simply too large in pixels.
Pixels and megapixels
A megapixel is a million pixels. A typical 12-megapixel phone photo is 4032 × 3024 pixels, which is 12,192,768 pixels.
The file on disk is compressed, but to show or edit the picture a program has to decode it into every pixel. At four bytes per pixel (red, green, blue and transparency) that 12-megapixel photo takes about 49 MB of memory, whatever the size of the file. That is why a phone can struggle with dozens of large photos at once, and why a web page full of oversized images feels slow even after they have downloaded.
Our 1280 × 854 test photo shows the gap between pixels and file size. Stored raw, three bytes per pixel, it is 3.3 MB. As a PNG, which loses nothing, it is 2.3 MB. As a JPEG at quality 82 it is 323 KB, about a seventh of the PNG, and it looks the same at normal viewing size.
DPI only matters on paper
JPEG files can carry a density value: the JFIF standard has a field for dots per inch or per centimetre, and camera metadata has a similar one. Many photos say 72 or 300 there. The number does not change a single pixel, the file size or how the picture looks on screen. Screens show pixels, not inches.
Changing 72 DPI to 300 DPI without resampling only rewrites that field. If a form demands “300 DPI”, what it usually needs is enough pixels for the printed size. The sum is simple: printed width = pixels ÷ pixels per inch, and one inch is 2.54 cm.
| Print size | At 150 pixels per inch | At 300 pixels per inch |
|---|---|---|
| Photo 10 × 15 cm | 591 × 886 px | 1181 × 1772 px |
| A4, 21 × 29.7 cm | 1240 × 1754 px | 2480 × 3508 px |
| 12 MP photo (4032 × 3024 px) | 68 × 51 cm | 34 × 26 cm |
The print service decides which density it wants; with that number, the table tells you whether the photo has enough pixels. Adding pixels on a computer does not help, as the section on enlarging shows.
Screens: CSS pixels and sharp displays
Web pages are laid out in CSS pixels, a unit defined as 1/96 of an inch. On older screens one CSS pixel was one dot on the screen. Phones and many laptops now use two or three screen dots for each CSS pixel; browsers report this as the device pixel ratio.
So an image shown 600 CSS pixels wide needs about 1200 pixels to look crisp on a phone with a ratio of 2. Give it only 600 and it is stretched and looks soft; give it 4000 and visitors download pixels they never see. Websites can offer several sizes with the srcset attribute and let each browser pick the one that suits its screen.
Resizing: smaller is safe, larger adds nothing
Halving the width and height keeps a quarter of the pixels, and the file shrinks roughly in step. In our test, all at JPEG quality 82:
| Dimensions | Share of the pixels | JPEG size | WebP size |
|---|---|---|---|
| 1280 × 854 | 100% | 323 KB | 288 KB |
| 960 × 641 | 56% | 180 KB | 159 KB |
| 640 × 427 | 25% | 89 KB | 80 KB |
| 320 × 214 | 6% | 23 KB | 21 KB |
Going the other way does not bring detail back. We shrank the photo to 320 pixels wide and enlarged it again to 1280: the result scored 0.59 on SSIM, a measure of how close two images are where 1 means identical, against 0.96 for the full-size JPEG at quality 82. It is visibly blurred. Enlarging only spreads the existing pixels over more space; AI upscalers make it look sharper by inventing plausible detail, which is not the original.
Browsers can scale an image with more or less careful smoothing; the nTools resizer asks for the highest setting. Keep the proportions when resizing, or faces and circles stretch. When an exact shape is needed, such as a square profile picture, crop first and then resize.
What the quality number means
The quality setting is not a percentage of anything. For JPEG it is a 0 to 100 scale, defined by the reference JPEG library, that controls how coarsely detail is rounded away; its documentation suggests 50 to 95 for photos and warns that above about 95 the file grows dramatically for little gain. WebP has its own scale, so the same number does not mean the same thing in both formats.
Our measurements, on the 1280 × 854 photo in Chrome, with SSIM against the original (1 means identical):
| Quality | JPEG size | JPEG SSIM | WebP size | WebP SSIM |
|---|---|---|---|---|
| 50 | 181 KB | 0.915 | 180 KB | 0.944 |
| 75 | 270 KB | 0.950 | 231 KB | 0.963 |
| 82 | 323 KB | 0.962 | 288 KB | 0.976 |
| 92 | 466 KB | 0.981 | 410 KB | 0.988 |
| 95 | 570 KB | 0.987 | 474 KB | 0.990 |
| 100 | 1275 KB | 0.999 | 1306 KB | 1 (lossless) |
| PNG | 2302 KB | 1 (lossless) | – | – |
Three things stand out. Going from 95 to 100 more than doubles a JPEG for almost nothing visible. At the same similarity WebP is about a third smaller than JPEG, in line with Google’s figure of around 30%: WebP at 82 matches JPEG at 90 in 288 KB instead of 428 KB. And in Chrome, WebP at 100 switches to lossless compression, which here came out 43% smaller than the PNG.
When a website or program does not say which quality it uses, Chrome’s defaults are 92 for JPEG and 80 for WebP; we measured both by saving without a quality value. The nTools resizer starts at 82.
Colour detail goes first
JPEG stores brightness and colour separately, and the eye is far more sensitive to brightness. Most encoders therefore keep colour at half the width and half the height, a scheme called 4:2:0: a quarter of the colour information, with little visible effect on photos. It is the default in the reference JPEG library, and Chrome used it at every quality we tried except 100.
Where it shows is thin, saturated detail: red text on a white background, coloured lines in a chart or a logo. The edges bleed. For screenshots and graphics with text, PNG or lossless WebP avoids the problem, as the first part of this series explains.
Saving again and again
Each time a lossy file is opened, edited and saved, it is compressed again. How much is lost depends on whether the settings change. We saved the test photo ten times in a row:
- Always at JPEG quality 82, with no edits: SSIM went from 0.962 after the first save to 0.957 after the tenth, and the file stayed at 322 KB.
- Alternating between quality 82 and 75, as happens when a photo passes through different apps: SSIM dropped to 0.933, worse than a single save at quality 70.
Keep the original, make every copy from it, and do the resizing and quality change in one step at the end.
Sizes that work
These starting points come from the measurements above. Our test photo used about 0.3 bytes per pixel at JPEG quality 82; busy scenes with foliage or gravel need more, plain skies and walls less.
| Use | Long side | Format and quality | Expect roughly |
|---|---|---|---|
| Image in a web page | Display width × 2 | WebP 75–82 or JPEG 80–85 | 100–400 KB |
| Email or messaging, several photos | 1600–2000 px | JPEG 80–85 | 0.5–0.9 MB each |
| Upload form with a 1 or 2 MB limit | 2000 px | JPEG 80 | under 1 MB |
| Print size × the density the printer asks for | JPEG 92–95, or the original | several MB | |
| Screenshot or graphic with text | Unchanged | PNG or lossless WebP | depends on content |
Gmail allows 25 MB of attachments per message on personal accounts and turns anything larger into a Google Drive link, so a handful of untouched phone photos can already reach the limit.
Everything the nTools image tools do happens in your browser: the photo is not uploaded anywhere.
Frequently asked questions
Does changing 72 DPI to 300 DPI improve a photo?
No. It only rewrites a number in the file. The pixels, the file size and the look on screen stay exactly the same. A print gets sharper only with more pixels, taken by the camera, not added afterwards.
Why does my resized photo look blurry?
Usually because it was made smaller than the space it is shown in and then stretched, for example on a phone screen with a device pixel ratio of 2 or 3. Make it about twice the width at which it is displayed.
What quality should I use for JPEG?
Between 75 and 85 suits most photos on screens. Above 95 the file grows quickly for little visible gain, and 100 is not lossless.
Is WebP always smaller than JPEG?
For photos at the same visual quality it usually is, by about a third in our test. Check that the place you are sending it to accepts WebP; some older programs and forms do not.
Can a small image be enlarged without losing quality?
No. Enlarging cannot recreate detail that was never captured. AI upscalers can make the result look sharper, but they invent the extra detail.
Why is my PNG photo so much bigger than the JPEG?
PNG keeps every pixel exactly, which suits screenshots and graphics. For photos it produced a file about seven times larger than a JPEG at quality 82 in our test, with no visible difference at normal viewing size.
Previous in the series ← Image formats explained: JPEG, PNG, WebP, AVIF and HEIC
References
- MDN — <length>: absolute length units (px, in)
- MDN — Window: devicePixelRatio property
- MDN — Responsive images
- MDN — HTMLCanvasElement: toBlob() method
- MDN — CanvasRenderingContext2D: imageSmoothingQuality property
- JPEG File Interchange Format (JFIF), version 1.02
- libjpeg-turbo 3.0.2 — usage.txt (cjpeg: -quality, -sample)
- Google for Developers — WebP: Frequently Asked Questions
- web.dev — Serve images with correct dimensions
- Gmail Help — Send attachments with your Gmail message
Related guides
- IP addresses explained: IPv4, IPv6 and the reserved ranges
- Subnets and CIDR explained: prefixes, masks and usable hosts
- DNS records explained: A, AAAA, CNAME, MX, TXT and NS
- Is a website down, or is it just you? How to check, step by step
- HTTP status codes and Cloudflare errors: what 403, 404, 429, 500, 503 and 521 mean
- Unix timestamps and time zones explained
- Counting dates: days between dates, leap years and ISO weeks
- Image formats explained: JPEG, PNG, WebP, AVIF and HEIC
- Password strength explained: length, entropy and passphrases
- Hash functions explained: SHA-256, checksums and password hashing
- JSON Web Tokens explained: claims, signatures and safe validation
- UUIDs explained: v4, v7 and choosing the right version
- QR codes explained: capacity, error correction and print size
- Percentages and VAT explained: adding, removing and stacking
- Common JSON errors and how to fix them
- Editing PDFs in the browser: what merging, splitting and converting keep