9
\$\begingroup\$

So I have 2 JPEG files at 2000x2000 pixels, that I made out of Photoshop: (wetransfer_2-jpg_2023-04-26_2146.zip)

File_1) I saved directly from an RGB TIFF with "save as" JPEG quality 9 -- that file is roughly 75.5 MB

File_2) I copied and pasted each individual (R/G/B) color channel from the TIFF into a single new document of equal pixel size and then used "save as" JPEG quality 9 -- that file is roughly 625 KB

what is going on here? I have tried to use Beyond Compare to see differences in metadata or similar, but am not skilled/knowledgable enough to see the issue. It is a very large file size difference and I am really puzzled here!

\$\endgroup\$
6
  • 1
    \$\begingroup\$ Please post your example to a place that doesn't require agreeing to terms of service such as those at the link to view. Imgur, for example. \$\endgroup\$
    – Michael C
    Apr 27 at 3:24
  • 6
    \$\begingroup\$ @MichaelC I wish the OP would, but not Imgur. This analysis needs a host that doesn't treat the file contents as an image but as a blob of data. Imgur reprocesses files. This downloads as 164.9 kiB, but was 166.8 KiB before upload. The difference isn't just in the EXIF data (that would only account for 1.1 B). The sunrise photo, BTW, is the background on my right monitor, half a panorama I shot on a hike. It was the first thing I found that I had all rights to upload. \$\endgroup\$
    – Chris H
    Apr 27 at 8:19
  • \$\begingroup\$ What are you actually trying to do? Why are you messing about with pasting colour channels around the place? \$\endgroup\$
    – osullic
    Apr 27 at 11:13
  • \$\begingroup\$ Just had a feeling the file was WAY too big and and when I pasted composite RGB pixel data into a new file it didn't change the filesize, so I took the data apart the only way I knew how, to convince the computer I ONLY wanted image data -- not any metadata it thought I needed or wanted... \$\endgroup\$
    – Toby
    Apr 27 at 14:16
  • \$\begingroup\$ You could have done the same by just copy/pasting a layer into a blank image? Or did this also drag in the metadata? \$\endgroup\$
    – xenoid
    Apr 27 at 15:07

1 Answer 1

19
\$\begingroup\$

The big file contains very bulky metadata that seem related to "Document Ancestors" (whatever that means), as demonstrated using exiftool(*):

Small file:

ExifTool Version Number         : 12.40
File Name                       : 2.jpg
Directory                       : .
File Size                       : 610 KiB
File Modification Date/Time     : 2023:04:26 23:46:39+02:00
File Access Date/Time           : 2023:04:27 08:25:33+02:00
File Inode Change Date/Time     : 2023:04:27 08:25:10+02:00
File Permissions                : -rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
Exif Byte Order                 : Big-endian (Motorola, MM)
Orientation                     : Horizontal (normal)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Software                        : Adobe Photoshop 22.5 (Macintosh)

[etc....]

Big file:

ExifTool Version Number         : 12.40
File Name                       : 1.jpg
Directory                       : .
File Size                       : 72 MiB
File Modification Date/Time     : 2023:04:26 23:46:39+02:00
File Access Date/Time           : 2023:04:27 08:25:17+02:00
File Inode Change Date/Time     : 2023:04:27 08:25:10+02:00
File Permissions                : -rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
Exif Byte Order                 : Big-endian (Motorola, MM)
Orientation                     : Horizontal (normal)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Software                        : Adobe Photoshop 22.5 (Macintosh)
Document Ancestors              : 0, 0000471C09D4159FD6238FB4FD814C8D, 000076180AF04FD351A948E221782809, 00007690EE61955F5FD43EA8AF3C1304, 0000A6C7815905497C2762FB3073AC1B, 0000FE4F1FBA4CC1FCE5458F3A9761FB, 000157BB4EC66C832CEA7D49818F2BB7, 00017C97C28B0C407DB5E9F93F00B063, 0001B7F957AD0C86828CD343E87AEC1C, 0001D40A7B18F3382B14F2E780D08129, 0001E457A018BB7DC721DC767178D01B, 00020F3718874DEC579311A3537474EE, 000221B48B15CB3F04C863946D256D35, 0002842703441D4A10B778F919DB2C49, 0002B0E39668FE325CA514C4B5BE725D, 0002D4A76613A872D72F9F2696C778E9, 000331F19A13944845140188375C7674, 0003C8770168CFEB622F1A6523EA33CE, 0004EAB42FF2EEBC5DB3FCB6B879B558, 0004F219969ECF9B707A9B90C0D00CD1, 0A829E927819B4D576B0B45AADE12D, 000AB192EC844703B32FE95585910613, 000ABA1A699C389D573DBC0C7944D2C3, 000B31C4C6A0712A9EA701121B2AF287, 00D758B3CD8D758A5539C67FABC7E0C8, 00D76CFCF8B72167E9DFED384D0F7942, 00D775CF9F469FBAF615184FEB8DA3AF, 00D7A0DE840C484B767F4D68CF94477D, 00D7A4FDB541A9BFB611BDA0834208C4, 00D7A8F02240527311744902D1AE411E, 00D7B29953042F6D84A60C6BD4852931, 00D7CEAB897F54801CC1E218F7EE6E28
Warning                         : [Minor] Extracted only 1000 photoshop:DocumentAncestors items. Ignore minor errors to extract all
History Action                  : created, saved, saved, saved, saved, saved, saved, saved, saved, saved, saved, saved, converted, derived, saved
History Instance ID             : xmp.iid:44a09451-dbf1-4275-b9fd-af392f197c12, xmp.iid:c384f05b-6324-451b-8469-98eb9cd9c98e, xmp.iid:7382e449-a14c-466c-b5f0-c2ec0d934da8, xmp.iid:7620c5de-1242-4e61-ab37-134c0049fa15, xmp.iid:985c9ea0-d8ef-42e8-a417-e4d3a2b24b02, xmp.iid:c705addc-4a2d-4758-8408-684745076736, xmp.iid:dac71b79-740d-4100-bbd0-8fbdace87867, xmp.iid:becd1e89-1eef-43ba-9b56-889db8a7782a, xmp.iid:ae6fe371-a95e-4e62-9262-3d133c4cab5d, xmp.iid:92376da9-b3cc-4b29-a778-9275c0e3c5e3, xmp.iid:98ba57f7-dd9b-4664-bbc1-bbb03ba1d520, xmp.iid:2c3073ce-5c16-45b2-95f2-5d62889092d5, xmp.iid:6ac41532-5cab-43c0-afa3-9a2f7d22ed2f
History When                    : 2021:08:18 10:22:30-04:00, 2021:08:18 10:37:03-04:00, 2023:03:26 18:23:29-04:00, 2023:03:26 18:36:43-04:00, 2023:03:26 18:41:57-04:00, 2023:03:27 18:28:31-04:00, 2023:03:27 18:29:04-04:00, 2023:04:07 18:09:45-04:00, 2023:04:07 21:30:55-04:00, 2023:04:08 14:52:38-04:00, 2023:04:09 11:17:05-04:00, 2023:04:26 17:00:30-04:00, 2023:04:26 17:00:37-04:00
History Software Agent          : Adobe Photoshop 22.4 (Macintosh), Adobe Photoshop 22.4 (Macintosh), Adobe Photoshop 23.4 (Macintosh), Adobe Bridge 2022 (Macintosh), Adobe Photoshop 23.4 (Macintosh), Adobe Photoshop 22.5 (Macintosh), Adobe Bridge 2022 (Macintosh), Adobe Photoshop 23.4 (Macintosh), Adobe Photoshop 23.4 (Macintosh), Adobe Bridge 2022 (Macintosh), Adobe Photoshop 23.4 (Macintosh), Adobe Photoshop 22.5 (Macintosh), Adobe Photoshop 22.5 (Macintosh)
History Changed                 : /, /, /metadata, /, /, /metadata, /, /, /metadata, /, /, /
History Parameters              : from application/vnd.adobe.photoshop to image/jpeg, converted from application/vnd.adobe.photoshop to image/jpeg
Derived From Instance ID        : xmp.iid:2c3073ce-5c16-45b2-95f2-5d62889092d5
Derived From Document ID        : adobe:docid:photoshop:2dab377d-52d8-e34f-9b73-f2f80c061c2b
Derived From Original Document ID: xmp.did:44a09451-dbf1-4275-b9fd-af392f197c12

[etc...]

Note: Data is way bigger that what is shown here because

  1. As mentioned in a Warning line, exiftool only extracted the first 1000 DocumentAncestors values.
  2. I had to truncate further to fit the size limit of posts.
  3. The data is formatted as an XML data structure and XML isn't known for its conciseness; people jokingly say that XML stands for eXtreMely Large.

This seems to be a known problem.

You probably have options to not save EXIF/XMP metadata in your software. Later comments pointed at a Save for web option in Photoshop.

Otherwise you can also use exiftool to remove selected metadata:

> # Remove the data with exiftool
> exiftool -DocumentAncestors= 1.jpg 
Warning: [minor] Excessive number of items for photoshop:DocumentAncestors. Processing may be slow - 1.jpg
    1 image files updated
> # Show resulting sizes:
> stat -c "%8s %n"  *.jpg*
  630629 1.jpg
75475852 1.jpg_original
  624943 2.jpg

So you can see from the above that without the ancestors the file sizes are equivalent.

If you create your file from existing sources, you may be inheriting their ancestors, so you could use the command above to prune the history of these files.

(*) exiftool is the canonical CLI utility to explore & edit image metadata. Available free for all platforms.

\$\endgroup\$
7
  • 2
    \$\begingroup\$ I reckon the "ancestor" is the entire TIFF, although the image as uncompressed TIFF is 11MB. exiftool 1.jpg | grep 'Document Ancestors' returns a load of hex values, but that line is only 34 kiB (from | wc --bytes) made up of 32 character (256 b) chunks. I reckon they're offsets to segments in the file; JPEG file segments can store arbitrary data. \$\endgroup\$
    – Chris H
    Apr 27 at 8:11
  • \$\begingroup\$ As I said, 1) exiftool only shows the first thousand and 2) the whole thing is actually XML formated and exiftools has stripped it out. Try grep -ao -E '<rdf:li>[^<]+</rdf:li>' 1.jpg | wc -c and it reports 74693649 bytes.... (inspired by this screenshot). \$\endgroup\$
    – xenoid
    Apr 27 at 9:02
  • \$\begingroup\$ If you think the regex above catches too much, with this more focused one: grep -ao -E '<rdf:li>(xmp\.did:)?[0-9A-F]+</rdf:li>' 1.jpg | wc -c you still get 48+MB. There are 1311899 (1.3M) <rdf:li> tags in the f rile. \$\endgroup\$
    – xenoid
    Apr 27 at 9:07
  • \$\begingroup\$ Ah, I saw that but wasn't sure what it was the first 1000 of (actually I'm still not - it seems right to be the first 1000 fields in the Document Ancestors : line. It would have been clearer if Firefox hadn't started hiding the scrollbar on code blocks until you mouseover the box - that makes it obvious that the lines are really very long. \$\endgroup\$
    – Chris H
    Apr 27 at 9:53
  • 6
    \$\begingroup\$ Photoshops "save for web" should strip this out. \$\endgroup\$
    – ths
    Apr 27 at 11:06

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.