I just took two photos on my smartphone. One of a table surface with nothing on it and another of a cluttered table top full of detail. The clear photo was 3.5 MB and the cluttered one was 5 MB. How is this possible? The resolution is the same so they have the same number of pixels. Why would one create a larger image file than the other?

  • If there is a good landscape of thing you absolutely want in maximum quality, take two shots without changing anything (position, time, ...) and at home throw away the one with the smallest file size. You'll have the one with the greatest details (don't bother with a smartphone, quality is too low to need this kind of tricks).
    – FarO
    Jan 20 '16 at 17:42
  • 4
    I supposed the image format is jpg, right?
    – Dragos
    Jan 20 '16 at 18:00
  • In some cases even orientation can make a difference. Try doing a simple line drawing of the American flag and saving it as a GIF. Rotate 90 degrees and save as a separate GIF. The vertical version will have a bigger file size. JPEG compression is a little more complicated than that, but the point is that image detail certainly affects file size. Jan 21 '16 at 4:12
  • To add another interesting fact - a higher ISO (on a camera that can control it) will also lead to a higher file size for the exact same scene because the added noise of the high ISO will reduce the efficiency of the compression algorithm. To the algorithm, adding noise is similar to adding details.
    – JPhi1618
    Jan 21 '16 at 14:05

This is not only possible, but extremely likely, when you're using a compressed image format such as JPEG. Data compression methods in general become more efficient as the data to be compressed decreases in entropy (try creating zip files of a large page of actual text vs. the same sized page of a single repeated character).

The more features or fine textured detail that an image contains, the less the compression can "cheat" by simplifying the data that it stores to represent the image when it's uncompressed. On the other hand, cameras that store images as uncompressed RAW files tend to produce similar-sized files per image, regardless of image content.

A lossy format like JPEG, because it actually discards some inessential data in a very clever way while compressing, can often achieve ratios up to 10:1 while still giving a decent representation of a typical photograph, while a lossless compression format that retains all data might only achieve 2:1 compression, or less.

  • 3
    "while a lossless compression format that retains all data might only achieve 2:1" This is not true. Take for example this files. They are not photographs but they have 16 million diferent colors. Losless compression png and they weight only 60k. libpng.org/pub/png/img_png/16million-pschmidt.png The amount of compression also depends onthe content of the file.
    – Rafael
    Jan 20 '16 at 17:16
  • 3
    @Rafael - made the wording clearer, talking about a typical photographic image here. Jan 20 '16 at 21:28
  • 3
    This answer is correct. It's all about compression. Compression, in general, works by looking for redundant or repeated data. If most of a photo consists of the same data then it can be compressed a large amount. Jan 21 '16 at 1:12
  • 1
    @Rafael He wrote "might only achieve" while you understood "must only achieve".
    – Agent_L
    Jan 21 '16 at 9:04
  • Also: most DNG files are compressed with an algorythm similar to JPEG. Mar 15 '16 at 16:04

This is absolutely normal. While the sensor always samples the same amount of data, the file does not need the same number of bytes to represent different images. The more details there are, the more bytes it takes to represent its contents.

This is particularly true of lossless formats like most RAW, DNG and TIFF. They use algorithms to represent the sensor data or image content in fewer bytes but there is a lower bound to how small such a file can be.

Lossy formats such as JPEG usually also vary in size by details but that depends. On some cameras you can choose between Size and Quality priority. With Size priority, the compression algorithm discards details until it fits with a certain size. Even that, if you take a shot with the lens capped, the file produced will be rather small. With Quality priority, a certain amount of details get removed during compression, so the file will vary in size more because it depends on how much details were in the scene to start with.

Here is an very interesting fact: It does not matter if the details captured are real or not. Noise adds variance in images which are equivalent to details for storage purposes. If you take a photo of exactly the same scene but at different ISOs, the higher ISO image will be larger!

  • Actually, it often does matter if the details are real: real details generally increase the file size less than noise does. Noise reduction on a compressed image will only work if the compression keeps the noise, and storing the noise will often consume more bits than storing everything else.
    – supercat
    Jan 20 '16 at 22:20
  • @supercat Here's an experiment showing the effect of noise on JPEG size (quality priority). Size is in bytes, written under each image. Of course the results should significantly depend on the encoder itself as lossy encoders have many choices to make about what details can be thrown away without humans noticing ... dropbox.com/s/gla3lmbe1d831od/lena.png?dl=0
    – Szabolcs
    Jan 21 '16 at 9:55
  • How was the compression factor adjusted between pictures, if at all? It's possible to get even a noisy picture down to a small file size, but unfortunately doing so will make it impossible to use statistical methods to filter out the noise later.
    – supercat
    Jan 21 '16 at 16:08

If you have several dozen random JPG images from one camera (many scenes, but all of same image size) in a folder, and then sort them by file size ("details" view), it is hard to say what your pictures might be, but their JPG file size will vary (largest vs. smallest) probably at least 2 to 1, and extremes can be much more, possibly 8 to 1 (just for some number, there are no limits). The large file scenes will be full of very much highly detailed features (trees with many leaves, etc), and the smallest files will be very plain, almost devoid of subject detail (blank sky or walls, etc).

JPG compression can compress the plain bland featureless scenes much more effectively than a scene crammed with much tiny detail. The general idea of compression is to save only a few things to be shown repeated in many places, as opposed to saving many things to show individually.

All JPG images are 3 bytes per pixel (a pixel is one RGB color) when uncompressed in computer memory, but they are compressed much smaller when in the JPG file. This difference is called the JPG compression ratio. For example, an image size of 6000x4000 pixels (24 megapixels) is always x3 or 72 million bytes (68.7 megabytes) when uncompressed RGB in memory. However, the JPG file is compressed, and might be generally around 1/4 or 1/8 or 1/16 that size compressed (any value, compression depends on the JPG Quality factor selected, small files are low quality, large files are best quality). This JPG Quality factor will be a fixed menu setting in the camera, so likely the same unchanged value for all images from one camera.

But still the final file size will also vary with the degree of fine details in the scene. An example is shown at http://www.scantips.com/basics09b.html#size

  • "All JPG images are 3 bytes per pixel (a pixel is one RGB color)" Not acurate. There are 4 channel jpgs.
    – Rafael
    Jan 20 '16 at 17:51
  • 1
    but probably NOT in Adobe, Firefox, or Google, or print labs. :)
    – WayneF
    Jan 20 '16 at 18:38
  • Wikipedia indicates, but does not actually make the claim, that JPEG doesn't need to be 24 bpp, even if restricted to three channel (RGB) images.
    – user
    Jan 21 '16 at 9:14

The long answer has already been covered pretty well, which is that compressed file formats don't actually record every pixel. They do something along the lines of recording a particular color of a particular pixel and then recording "this color is used again at x, y, and z locations." This is (theoretically) fine if you've captured your image exactly as you want to shoot it. But if you need to change the colors, brightness, etc of an image, you'll find that you have very little flexibility as what you see is basically all that's been recorded.

The short answer is "if your camera gives you the option to shoot raw you really want to use it."

  • but the short answer doesn't answer the question. =)
    – scottbb
    Jan 21 '16 at 13:03

Create a 300dpi image in PS, say 5000px by 3000px, fill with white and save as a JPG, image quality on max. You'll have a JPG of around 1mb file size. Now back in PS go to filters and add some noise, no more than 1% so you can barely notice it. Now save the file again, same settings, JPG with max image quality. The file size (on disk) will now be around 6mb.

So, image size (in mb) is directly related to the pixel content of the image as well as the pixel content. Two images from the same camera using the same settings and exported from LR or PS using the same settings will be different if the image content is different.

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.