convert2image

Why the same photo is 3 MB as a JPG and 30 MB as a PNG

Take one ordinary 12 megapixel phone photo and save it in different formats. The results are startling. As a HEIC straight from the phone it might be 2 MB. As a JPG, 4 MB. As a WebP, 3 MB. As a PNG, 25 MB. As a BMP, 35 MB. Same picture, same pixel dimensions, a seventeen-fold spread.

None of it is arbitrary. File size comes from two things: how much raw data the picture holds, and how much of that data the format manages to avoid storing.

Start with the raw number

A 12 MP phone photo is typically 4032 × 3024 pixels, which is 12,192,768 pixels. Each pixel in a normal colour image needs three bytes, one each for red, green and blue. Multiply it out and you get about 36.6 million bytes, roughly 35 MB.

That is the uncompressed size, and it is almost exactly what a 24-bit BMP comes to, because BMP normally does no compression at all. Every other format is trying to beat that number.

Lossless compression looks for repetition

PNG is lossless: when you open it, you get back exactly the pixels that went in. It gets smaller by finding patterns. A row of 500 identical white pixels can be stored as “white, 500 times” instead of 1500 separate bytes. PNG also predicts each pixel from its neighbours and stores only the difference, which is often a small number that compresses well.

That works superbly on screenshots, logos and diagrams, which are full of flat colour and repeated shapes. A 4-megapixel screenshot can easily be a few hundred KB as PNG.

Photos are different. Every pixel differs slightly from its neighbours because of real texture, lighting and sensor noise. The differences are small but unpredictable, and unpredictability is what compression cannot remove. So a PNG photo usually shrinks to somewhere between half and three quarters of the raw size. Our 35 MB becomes 15 to 25 MB.

Lossy compression decides what you will not miss

JPG, WebP, AVIF and HEIC take a different approach. They throw away detail that the eye is unlikely to notice: very fine variation in colour, subtle high-frequency texture, noise. Then they compress what is left. The result is not identical to the original, but at sensible settings it looks it.

This is dramatically more effective on photos. A good JPG of our 12 MP photo is 3 to 5 MB. The newer formats are more efficient at deciding what to discard and how to describe what remains, so WebP comes in smaller, and HEIC and AVIF smaller still.

FormatTypical size, 12 MP photoApproach
BMP~35 MBUncompressed
PNG15–25 MBLossless
JPG (quality 90)3–5 MBLossy, 1992 design
WebP (quality 80)2–3.5 MBLossy, 2010 design
HEIC1.5–2.5 MBLossy, based on HEVC video
AVIF1–2 MBLossy, based on AV1 video

These are ranges, not rules. The same settings on a different photo can give very different numbers.

What is in the picture matters as much as the format

Two photos with identical dimensions, saved with identical settings, can differ in size by a factor of three or more. A misty seascape with a smooth sky compresses beautifully. A forest, a gravel path or a crowd is packed with fine detail and comes out much larger. Photos taken in dim light carry a lot of noise, which looks like fine detail to a compressor and inflates the file.

That is why a fixed quality setting gives consistent appearance but inconsistent file size, and why hitting an exact size limit sometimes takes a couple of tries.

The biggest lever is pixel count

File size scales with the number of pixels. Halve the width and height, and you have a quarter of the pixels, and the file shrinks to roughly a quarter too. That is far more effective than lowering quality, and far less damaging. A 2000-pixel-wide photo is still sharper than any phone screen can show, and at a quality of 80 it is typically well under 1 MB.

So when a file is too big, resize first, then compress. Doing it the other way round, pushing quality down on a huge image, gives a worse picture at a larger size.

Why the numbers never quite match

One more source of confusion: there are two ways of counting. Storage makers and macOS use decimal units, where 1 MB is 1,000,000 bytes. Windows and many apps use binary units, where a “MB” is really 1,048,576 bytes. The same file can show as 36.6 MB on a Mac and 34.9 MB on a PC. Neither is wrong; they are counting in different sizes of box.

Planning storage

If you are working out how many photos fit on a memory card or how much space a shoot will take, the average file size is what matters, and it varies with format, resolution and subject in all the ways above. Take a sample of your own recent photos, average their sizes, and multiply up. StatGarden's photo shoot storage calculator handles the sums, including video, if you want a quick estimate.