2

I have two copies of the same image (jpeg). One is 4.0 MB the other 5.9 MB.

I have run

exiftool -a -G1 -s

and the only difference reported is the size.

I used hexdump to compare them and they seem to be identical except the second has more data at the end.

They did originally come from an an old Mac and one had extended attributes, including

com.apple.ResourceFork   118660

Does that mean the added data is a resource fork? Is it anything sinister?

I deleted the extended attribute using

xattr -d com.apple.ResourceFork image2.jpg

but that made no difference to the size of the file.

Why are the two files different sizes? I have other files like this. How do I get rid of the junk data at the end of the file?

ETA

With some more experimenting I did the following.

sips -s format jpeg image2.jpg --out image0.jpg

reduced the file size to 2MB, but the quality was reduced from 96% to 93%.

With

sips -f horizontal image2.jpg ; sips -f horizontal image2.jpg

reduced the file size to 2MB (but a tiny bit smaller than image0.jpg), but the quality was reduced from 96% to 93%.

With

convert image2.jpg image4.jpg

reduced the file size to 3.8MB, the quality was maintained at 96%.

I also noted that opening either original file with Preview caused Finder to add a

com.apple.quarantine

Extended Attribute.

  • Forgive me if this is a silly question, but if the images are otherwise identical to the naked eye, then why not just keep the ones of smaller file size and delete the others? Why go to the trouble of worrying about, and having to deal with, junk data? – Monomeeth Dec 30 '16 at 0:59
  • I had thought of doing that but there are too many images to go through one at a time. And some I may have only one copy of, and it may contain the junk. – pheon Dec 30 '16 at 1:13
  • If you locate the photo in Finder and right-click it and hit Get Info are the dimensions of the two images the same? And what about the two images' color space, color profile, and alpha channel? (comment back @owlswipe so I can help you more) – owlswipe Dec 30 '16 at 1:33
  • Everything is the same, except the size. – pheon Dec 30 '16 at 1:43

You must log in to answer this question.

Browse other questions tagged .