1

I have two versions of a JPG photo. According to the metadata, one has been saved in Shotwell while the other one is probably the orginal. Both files have the same resolution, dpi, bit depth, color space and compressed bits per pixel.

The presumed original is 877.472 bytes, the other version is 853.994 bytes. An image diff showed no difference. How can this be?

MikeW
  • 33,408
  • 10
  • 88
  • 123
  • Maybe the original have EXIF data? – Håkon K. Olafsen Aug 01 '14 at 22:33
  • The only difference in the EXIF data is that in the category main IFD, the field Software contains "Shotwell 0.9.3" in one case and "1.400" in the other case. But (877472-853994 bytes) divided by 4 (bytes per UTF-8 char) results in at minimum 5869.5 chars difference. So that doesn't seem to be the main reason. – 804b18f832fb419fb142 Aug 01 '14 at 22:46
  • Embedded thumbnail? – mattdm Aug 01 '14 at 23:35
  • 2
    Could be all sorts of stuff: metadata, padding or data that doesn't affect the display of the JPG itself. Also, even with lossless compression, different algorithms would produce different file sizes, but being lossless an image diff should show nothing. – MikeW Aug 02 '14 at 00:24
  • "4 (bytes per UTF-8 char)" UTF-8 is a variable-width encoding that requires between 1 and 4 bytes (strictly speaking, 8-bit sequences) to correctly encode a given Unicode code point. It can be generalized to encode any 31-bit sequence into up to 6 bytes. https://en.wikipedia.org/wiki/UTF-8#Description – user Aug 02 '14 at 16:03
  • I used 4 bytes to get the minimum number of chars. I didn't know about 5 and 6-byte chars, though. – 804b18f832fb419fb142 Aug 03 '14 at 00:56
  • I've seen these types of differences due to a couple of things - hidden meta data and a slightly different encoding process (even with the same compression). To check JPEG encoding, use JPEGSnoop. To check for hidden metadata use EXIFTool. One quick and dirty way to see how much metadata is contributing to the variation in file size is to strip the current metadata - perhaps by saving as a bitmap file. Based on your discussion so far, the resulting BMP files should be equiv if there is no diff in the image. – B Shaw Aug 03 '14 at 04:25

1 Answers1

0

If a jpeg has been resaved as another jpeg, the file size will always change because the image will undergo lossy compression. I.e. when you lose some information, the size of the file will change because the image is now a tiny bit different.

Did you apply any curves or levels to the image difference to exaggerate the difference between the two images?

JenSCDC
  • 2,339
  • 14
  • 23
  • First I used http://download.cnet.com/ImageDiff/3000-2192_4-10401778.html which showed that there was no difference, same with using the difference mode for layers in Gimp and applying curves and levels. – 804b18f832fb419fb142 Aug 02 '14 at 01:58
  • Interesting- I'd have thought that you'd have seen something. – JenSCDC Aug 02 '14 at 02:03
  • 1
    Resaved JPEG compression will eventually converge at the same image every time (with the same settings). Probably around ten times, but fewer is conceivable. See http://photo.stackexchange.com/a/34192/1943 – mattdm Aug 02 '14 at 03:44
  • That's interesting- I wonder if the standard was designed so that the saved images would converge or if it was an accident of mathematics. – JenSCDC Aug 02 '14 at 04:14