13

This image having resolution: 3200x2192 pixels has file size: 5.86 MB while this one has resolution of 6000x4000 pixels but file is of 4.55 MB. What is happening in both cases?

Any help to clear up this is appreciated.

Edit: Consolidating all answers and comments, pixel size is but only one factor of image file size. Others being, amount of details, compression, image noise etc. (future readers, read the answers and comments well to get a perspective). Below is an example of two images of same sunflower, shot under same lighting conditions and having same pixel size too (2592 x 3888), but varying ISO setting and shutter speed:

Image 1 - ISO 100, f/5.6, 1/350 s. Size- 2.17 MB

Image 2 - ISO 1600, f/5.6, 1/4000 s. Size- 4.15 MB

Source: https://en.wikipedia.org/wiki/Image_noise

Thank you, everyone, for providing great answers and comments.

| improve this question | | | | |
27

The reasons to have difference in size can be (and most of them are related to image compression):

  • Amount of details in the image. Save flat colour image and another with several colours and you will see the difference
  • Number of colours. Related to above, but if you have more colours and lossy compression you may have bigger image (as size)
  • Level of JPEG compression. This can change significantly the size
  • Amount of meta information in the image
  • High ISO can also result of bigger images (with the same other parameters) because higher noise (caused by high ISO) add "details" to the image.

And at the end size of the image (megapixels) is important but not so much

| improve this answer | | | | |
  • 8
    Maybe highlight that the first three are all about compression. A picture with many details is harder to compress, whereas a completely predictable image (say, a uniform red square) can be reduced to just a few bytes. The colors are just a specific case of this. In an uncompressed image, each pixel is just a triplet of R, G, B and it doesn't matter if it's a different color than all the others or if they are all the same. – tripleee Apr 2 at 10:47
  • 1
    A format with color indexing is just another form of compression, though a very simple one. Completely raw images are just pixels. – tripleee Apr 2 at 10:57
  • 3
    FWIW, There is "compression," and there is "coding," and it's not always obvious which label to stick on any particular technique (or, combination of techniques.) Best not to worry about it too much. – Solomon Slow Apr 2 at 16:46
  • 4
    @TheDude JPEG compression heavily favours large swaths of a single colour - such as the sky in the llama photo. There is a lot more "going on" in the bird photo. – Jan Dorniak Apr 3 at 8:58
  • 3
    Although technically correct, are there any cases where the amount of metadata is not negligible compared to image data in a multi-megapixel image? – gerrit Apr 3 at 12:40
21

For these two photos:

  • as shown by ImageMagick's identify, the bird is JPEG quality 100 and the llamas are JPEG quality 92). This alone would be enough to explain the size difference (the other factor, chroma-subsampling, is the same in both pictures). To put things in perspective, a test picture, exported with various quality settings (all other settings, including the chroma-subsampling, being the same):
+-----+------+
|  Q  | Size |
+-----+------+
|  95 | 1400 |
+-----+------+
|  97 | 1696 |
+-----+------+
|  99 | 2588 |
+-----+------+
| 100 | 3456 |
+-----+------+
  • the llamas picture is a bit less sharp, and blurriness compresses better.
| improve this answer | | | | |
  • 2
    Especially because "quality 100" is the massive overkill level. Generally speaking it produces files about twice as large as the next highest setting, with only tiny differences in quality. – hobbs Apr 2 at 19:46
  • 6
    the next highest setting being... 99? – Michael Apr 3 at 3:13
  • @xenoid "bluriness compresses better" - shouldn't the bird image,then, be of lesser size since it has totally blurred background? – The Dude Apr 3 at 8:55
  • 1
    @TheDude The background is blurry but the bird is very sharp. The llamas image is blurry all over. And in the JPEG algorithm what counts is the "local" blurriness, because the computation is done in 8x8 squares. Experiment: open a picture in your image editor, pixellize it to 8x8 squares and export to JPEG, then from the same image, apply a Gaussian blur that looks visually equivalent and export with same JPEG settings. Then compare the file sizes... – xenoid Apr 3 at 9:31
  • 2
    @TheDude If you look closely in the bird's background, you'll see that there is actually sharp camera noise there, so it is not completely blurry. If the JPEG compression level would be lower, that would have been removed, but at 100% it preserves even such tiny details. – jpa Apr 4 at 6:20
4

My colloquial explanation.

Image One: It is a big blue clear sky. Oh, and the image is big in size. Basically all the image is blue.

Image two: It is a green tree, on a field of colored flowers, (here is one, here is another (repeat several times) there is a farm, a house, there are some clouds, there are a pony and a fence, and next to the fence... But the photo is tiny.


Compression is all about how easy is to describe the scene and to store that information. If a lot of pixels are similar, a lot of them can be described with a single piece of code.

But if there is consecutive new information or details, you can not describe them in one sentence, but you need to describe them as they come.

| improve this answer | | | | |
  • JPEG doesn't do any intra prediction (unlike an HEIF image, i.e. an h.265 I-frame). It doesn't actually help at all that one 8x8 block is similar to another 8x8 block because each block is encoded totally on its own, not as "similar to this block in this direction, plus this difference (residual)". But yes, flat areas without sharp edges or detail tend to compress more easily, and if a lot of the image is like that it's usually the same in every block. – Peter Cordes Apr 5 at 12:48
2

It's to a good deal a matter of compression ratio. The 6000×4000 image has been loaded into and saved from Photoshop with a significant reduction in file size and also a bit of quality. The 3200×2192 size image appears like it is straight out of camera. However, it has been done in "Fine" quality JPEG and, kind of unusual for an in-camera picture, without chroma subsampling. While that's also what Photoshop used, it did so at significantly higher compression ratio in other respects. In general, cameras at "Fine" or even "Extra Fine" setting tend to be quite conservative in their compression settings to facilitate reasonable amounts of post-processing.

As an extreme example, here is a picture with considerable amount of flat color and a high JPEG compression ratio. The picture has 6MP of content and takes 70kB all-in-all. Including EXIF data and a 10kB thumbnail.highly compressed tiger cat

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.