Why does the size of a digital photo file vary so much if the photo is compressed the same amount and resized at the same dimensions as a another one? (Assuming both are color.)
The compression algorithm looks for areas in the image that are largely the same color and records its size and shape, rather than recording the same color for each pixel. If one image has lots of large areas of the same color (say, a picture of the sky) it will easily compress down a lot. If another picture is very chaotic and full of different colors, it will not be as compressable.
Assuming you start with two uncompressed photos of the same size, the reason is that different images are not compressed by the same amount using the same algorithm. The amount of compression depends on the patterns in the image.
Thanks. A near simul-post, too!
Also realize that not all file formats compress pictures the same way and choosing a format is largely dependant on your needs. JPEG, for instance, is a lossy compression algorithm. As such it can compress files fairly dramatically but it also loses information about the picture in the process. If you keep opening and re-saving a JPEG it becomes like a copy of a copy of a copy (off of a photocopier) and image quality suffers dramatically. The “lossy” aspect of a JPEG can be seen most easily in something like a picture of a blue sky that gradually fades from light to darker blue across the picture. If you look closely in many images you will see banding where the blue abruptly changes from one hue to the next. JPEGs often allow for a choice from the user in just how much compression they want to apply…smaller file or better quality.
Beyond that you can also find size differences if you change things like color depth (8-bit, 32-bit, etc.) as well as if it is saving in RGB or CMYK.