1
\$\begingroup\$

I apologize if this is the wrong stack exchange site, but I thought my question might be too specific to photo encoding for stack exchange. I recently recovered a host of digital picture files from a dead drive and after the recovery noticed that although all the photos are the same resolution and are one of three encoding formats (jpg, png, or tif), there are drastic differences in their file sizes. I know the efficiency of the compression can vary to a certain degree between photos, however, there are some as small as 112KB and others into the hundreds of megabytes. With the really enormous files I was pretty confident that the recovery tools just scraped some extra data into the photo files, so I started going through, opening the photos in paint and then re-saving them and files that were up to approx 300MB were encoded at just 600KB.

It got me wondering, if I open two files in paint and they are the same resolution and each pixel is the same color (ie, they look identical), can there be other data behind the scenes I'm not aware of that paint is cutting out that is important to the image, or will the encoding on two files of the same number of and color pixels be the same and result in identical sizes?

\$\endgroup\$
4
  • \$\begingroup\$ Uncompressed TIFF can leave you short of breath. The default is usually LZW (lossless) compressed these days, which is still substantially bigger than PNG or JPEG. \$\endgroup\$
    – user28116
    Aug 4, 2014 at 20:44
  • 1
    \$\begingroup\$ A clarification, please. Do you mean that TIFF files are very different from JPEG files in size, or that, say, JPEG files vary by that much? \$\endgroup\$
    – mattdm
    Aug 4, 2014 at 21:05
  • \$\begingroup\$ Also, doesn't sound like this is your case, but just for reference and just in case it helps, Why are my recovered images only 160x120 pixels? often applies to very small images found in data recovery. \$\endgroup\$
    – mattdm
    Aug 4, 2014 at 21:07
  • \$\begingroup\$ They are probably 95% jpg, making these my primary concern. Most of the TIFF files are similar sizes as well. \$\endgroup\$
    – fedora
    Aug 4, 2014 at 21:24

2 Answers 2

2
\$\begingroup\$

Not necessarily. If the format you are using makes use of compression, then different images of the same resolution can lead to different file sizes depending on how much variation it contains.

For example, I've attached is a beautiful 500x500px image I knocked up in MS Paint which I saved in full resolution in both jpeg and bitmap formats. For comparison I also saved a 500x500px pure white image in the same formats. The file sizes for each image came out like this:

  • Scribbly bitmap - 732kb
  • White bitmap - 732kb
  • Scribbly jpeg - 86kb
  • White jpeg - 4kb

So the short answer: it depends on the format.

500 scribbled pixels

\$\endgroup\$
1
  • \$\begingroup\$ Right, because of the compression algorithms. The problem I faced is that the recovery software evidently was recovering more than just the compressed data for each photo, as some were tens and hundreds of megabytes in size. It would be like having one "Scribbly jpeg - 860kB" and a visually indistinguishable "Scribbly jpeg - 86MB" which when re-saved, was only 860kB. \$\endgroup\$
    – fedora
    Aug 13, 2014 at 14:42
0
\$\begingroup\$

If every photo has the exact same image, DPI, metadata and compression, they should be the same.

There is a lot of data behind the scenes. It is called metadata. It contains the camera information, lens, aperture, stop set, copyright, location, and any other information the photographer wishes to add to it. This metadata can change the size of your files.

\$\endgroup\$
4
  • \$\begingroup\$ Ok, so opening and re-saving in mspaint might alter the metadata in some way, but I can be confident I'm not losing image quality with this practice as long as image, resolution, and file format are all the same? \$\endgroup\$
    – fedora
    Aug 4, 2014 at 20:49
  • 1
    \$\begingroup\$ @fedora If you are resaving as JPEG, you are (probably) losing image quality. See this answer for details. \$\endgroup\$
    – mattdm
    Aug 4, 2014 at 21:04
  • \$\begingroup\$ So even if I can toggle back and forth between the original and re-saved version and discern no change I could be losing quality? If this is the case, is there some tool I can use to quickly re-encode / re-compress all the images? You mentioned ImageMagick, might that work? The issue is that there are thousands and many have sizes hugely disproportionate to images of their resolution \$\endgroup\$
    – fedora
    Aug 4, 2014 at 22:01
  • \$\begingroup\$ @fedora - you can set up an automated action in Photoshop to open, then re-save all your photos. You can set the parameters to save the image with different parameters, including re-saving in uncompressed TIFF to avoid any image loss. I recommend that you save with a different file name to ensure the process worked as expected. \$\endgroup\$
    – B Shaw
    Aug 6, 2014 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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