The JPEG File Size Myth

“I need a High Rez JPEG file – it’s got to be at least 2MB”. Ever heard that one? It’s a completely meaningless statement. Okay if you’re emailing or uploading something and it needs to be BELOW a certain size then there is a degree of meaning, but it certainly doesn’t tell you anything about the size of the image contained in the JPEG. It certainly doesn’t mean it is high resolution. Why? Read on.

Create a new document in Photoshop (or just follow this) – I chose to create a standard A4 document which is filled with white:

Photoshop dialogue showing an A4 document filled with white
A preview of the document I have just created – yep, it’s just white!

Next I am just going to save that image as it is to the Desktop at the highest possible JPEG quality settings:

The file saving settings showing the highest available quality.

Now if I locate the file I’ve just saved on the Desktop and check it’s JPEG file size I can see that it is 597kb. That’s really small.

File Info showing the JPEG file size in the top right corner

That same document is still open in Photoshop so I am going to return to it and add a load of noise to the file. What does that do? Well it just adds random coloured pixels to the image (like you can see in the preview below).

The noise settings I used – you can see the random colours added to the image.
And here’s the previously white image with all the noise.

This time I am going to save it with a different name but ALL the other settings remain the same including the JPEG quality settings.

Renaming the file – all other settings remain the same.
The same quality settings as for the White image.

Now if I locate the file on the Desktop and check the file size again, this time it is 31.3MB. WOW – that’s over 60 times bigger than the white file!

File Info showing the JPEG file size in the top right corner

So the only thing that has changed (apart from the name of the file) is the content: originally it was filled with white and then I filled it with random noise. If you check back at both the File Info dialogues you will see that both images are 2480 x 3508 pixels – that’s EXACTLY the same image size, and the same resolution.

So that proves that the JPEG file size doesn’t mean a file is or isn’t high rez, and if that’s good enough for you then you can stop reading now. If you want to better understand why then read on – I will explain in Layman’s terms so it won’t be too techy!

Explanation

What’s happening then that the same size image has two different JPEG file sizes depending on what’s in the image? To understand that you need to appreciate that JPEG is a file saving format that was designed to make image files as small as possible with minimal loss of quality. I’ll come back to the quality later on, but for now lets consider how we can make the JPEG file smaller.

JPEG is a file saving format that describes what the image is and then looks for efficient ways of storing that data. To understand what’s going on it’s important to realise that any image you see on a screen is made up of lots of different coloured and different brightness pixels that describe/show the image.

And that’s the crux of it; with the White image EVERY pixel was the same brightness and was white so that was easy to describe – “Every pixel’s pure white guv” which is easy to save and makes the JPEG file size small as that’s all it contains (thats not strictly true but is good enough for the purpose of this article).

With the Noise image every pixel was a different colour and a different brightness so is much more difficult to describe. “Pull up a chair guv. Pixel 1 is bright green, pixel 2 is dark red, pixel 3 is mid yellow, pixel 4….” That makes a lot of data to store especially in our case where the image is 2480 x 3508 pixels or 8, 699,840 pixels in total (yes that’s over 8 Million pixels), all of which need describing and saving, and that’s a lot of data, which makes for a much larger JPEG file size.

Here’s a real world example – this image is from my Binary People project and it only consists of black and white so is a very small JPEG file.

Whereas this photo of Max A Hatter has lots more detail and colour information in so is a bigger sized JPEG file as there is a lot more detail to describe.

I said I’d come back to JPEG quality; one of the things to understand about the JPEG file format is that it is a LOSSY format which means that it throws some of the information away. It does this quite cleverly to minimise quality loss and in most cases the first save won’t have any immediate visible difference, but if you repeatedly open, and then close and SAVE a JPEG, it’s quality will continue to decrease and will become noticeable after repeated saves.

You have some control over the amount of data discarded in Photoshop and most image editing programs by using the quality slider. You may recall I saved both the images at a quality setting of 12, which is the maximum quality, and also makes the biggest file size as it keeps most of the data:

Save dialogue showing quality 12 and file size 29.7MB

Photoshop gives an estimate of the JPEG file size just next to the slider so if you slide it to the left the quality goes down (as the JPEG throws away more data) and so does the file size:

Save dialogue showing quality 5 and file size 7.6MB

It’s up to the user to decide what quality they should use, which will be dependant on the intended use; for use on a web site then a lower quality is acceptable as this speeds up the loading of the image and so improves the browsing experience. For printing though you would probably want the highest quality setting.

So hopefully you haven’t drifted off and that has been helpful. The content of the image will have the most affect on JPEG file size if you leave the quality the same when saving. If you are dealing with JPEGs and want to know the actual size then you can check the file info using Finder/Windows Explorer or you can open it up in an image editor such as Photoshop where you can see it.

The best way to ask for a file by size is to ask for pixel dimensions (so for A4 in our case 2480 x 3508) which guarantees that it is the correct resolution.

I don’t think that was too dry and techy but let me know if you have any questions.