Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ComponentsConfiguration tag in TIFF ExifIFD #53

Open
marhop opened this issue Jun 25, 2020 · 5 comments
Open

ComponentsConfiguration tag in TIFF ExifIFD #53

marhop opened this issue Jun 25, 2020 · 5 comments

Comments

@marhop
Copy link

marhop commented Jun 25, 2020

Hi Phil,

I have a question regarding mandatory tags that "may be added automatically with default values when creating a new IFD" according to the ExifTool docs, particularly the ComponentsConfiguration tag in the TIFF ExifIFD.

Using ExifTool 12.01 I used exiftool -ISO=42 on an uncompressed TIFF file (see attached file uncompressed-0.tif, source) and on the same file with LZW compression applied (compressed-0.tif, created with ImageMagick convert -compress LZW), resulting in uncompressed-1.tif and compressed-1.tif, respectively.

Adding the ISO tag results in this newly created ExifIFD (same in uncompressed and compressed files):

[EXIF:ExifIFD]  ISO                             : 42
[EXIF:ExifIFD]  ExifVersion                     : 0232
[EXIF:ExifIFD]  ComponentsConfiguration         : Y, Cb, Cr, -
[EXIF:ExifIFD]  FlashpixVersion                 : 0100
[EXIF:ExifIFD]  ColorSpace                      : Uncalibrated

I am a little confused by the ComponentsConfiguration tag.

  1. Should this tag really be included in the uncompressed TIFF file? If I am not mistaken the Exif 2.32 specification, page 83 reads like this tag is mandatory for compressed images but not allowed for uncompressed images. (On the other hand, the same spec, page 44 defines a default value for "RGB uncompressed" of R, G, B, -. So this is weird anyway.)
  2. Is the default value Y, Cb, Cr, - appropriate? The files use PhotometricInterpretation "RGB" which made me wonder: I thought RGB and YCbCr are two different color models, so wouldn't R, G, B, - be preferable in this case? But I don't know much about color stuff, so I may be totally lost here. Grateful for any clarification! ;-)
  3. ExifTool validation (exiftool -validate -warning -a) issues warnings for both uncompressed and compressed files: "ExifIFD tag 0x9101 ComponentsConfiguration is not allowed in TIFF". Huh?

Maybe you can enlighten me a little?

Thanks,
Martin

@boardhead
Copy link
Contributor

Hi Martin,

I think you are right that ExifTool is applying the mandatory tags without checking the TIFF type. Doing this properly will be some work, but I'll take a look and see what I can do.

@marhop
Copy link
Author

marhop commented Jun 25, 2020

Well, let me know if I can be of any help. My Perl skills are pretty out of date though ...

@marhop
Copy link
Author

marhop commented Oct 5, 2020

So ... having read the Exif specification a little more I don't think there is a distinction to be made between uncompressed and compressed TIFF files but only between TIFF and JPEG files:

Compressed files are recorded as JPEG [...]. Uncompressed files are recorded in TIFF Rev. 6.0 format.

(Exif 2.32, page 8)

As far as I can tell, compressed TIFF files are not mentioned at all in the spec and all relevant statements could just as well be read with uncompressed replaced by TIFF and compressed replaced by JPEG. So maybe a compressed TIFF file cannot, by definition, be a valid Exif image file or rather counts as uncompressed as far as Exif is concerned?

With this premise the ExifVersion, FlashpixVersion and ColorSpace tags are in fact mandatory for both uncompressed and compressed files. The ComponentsConfiguration tag on the other hand is not allowed in uncompressed (i.e., TIFF) but mandatory in compressed (i.e., JPEG) files. As a consequence, I can now answer my own questions from the original issue:

  1. No, ComponentsConfiguration should not be written to TIFF files, regardless of compression.
  2. Irrelevant - no tag, no default value.
  3. ExifTool validation is right.

So if you ask me, remove ComponentsConfiguration from the automatically added tags when writing TIFF files and everything's fine. But you should probably double check my assumptions first. ;-)

Cheers,
Martin

@boardhead
Copy link
Contributor

boardhead commented Oct 5, 2020

Hi Martin,

Interesting. I haven't re-read the spec, but Photoshop has options to save compressed TIFF images using LZW, ZIP and JPEG compression. I don't have time right now to check the metadata that is written for each of these, but I'll try this when I get a chance and run each of them through the ExifTool validation.

  • Phil

@boardhead
Copy link
Contributor

boardhead commented Oct 15, 2020

OK, this is what I get:

% exiftool tmp -validate -warning -a
======== tmp/Uncompressed.tif
Validate : 4 Warnings (2 minor)
Warning : Missing required TIFF ExifIFD tag 0x9000 ExifVersion
Warning : Missing required TIFF ExifIFD tag 0xa000 FlashpixVersion
Warning : [minor] ExifIFD tag 0xa002 ExifImageWidth is not allowed in TIFF
Warning : [minor] ExifIFD tag 0xa003 ExifImageHeight is not allowed in TIFF
======== tmp/CompressedLZW.tif
Validate : 4 Warnings (2 minor)
Warning : Missing required TIFF ExifIFD tag 0x9000 ExifVersion
Warning : Missing required TIFF ExifIFD tag 0xa000 FlashpixVersion
Warning : [minor] ExifIFD tag 0xa002 ExifImageWidth is not allowed in TIFF
Warning : [minor] ExifIFD tag 0xa003 ExifImageHeight is not allowed in TIFF
======== tmp/CompressedZIP.tif
Validate : 5 Warnings (2 minor)
Warning : Missing required TIFF ExifIFD tag 0x9000 ExifVersion
Warning : Missing required TIFF ExifIFD tag 0xa000 FlashpixVersion
Warning : [minor] ExifIFD tag 0xa002 ExifImageWidth is not allowed in TIFF
Warning : [minor] ExifIFD tag 0xa003 ExifImageHeight is not allowed in TIFF
Warning : Invalid value for IFD0 tag 0x0103 Compression
======== tmp/CompressedJPEG.tif
Validate : 6 Warnings (2 minor)
Warning : Missing required TIFF ExifIFD tag 0x9000 ExifVersion
Warning : Missing required TIFF ExifIFD tag 0xa000 FlashpixVersion
Warning : [minor] ExifIFD tag 0xa002 ExifImageWidth is not allowed in TIFF
Warning : [minor] ExifIFD tag 0xa003 ExifImageHeight is not allowed in TIFF
Warning : Invalid value for IFD0 tag 0x0103 Compression
Warning : Invalid value for IFD0 tag 0x0106 PhotometricInterpretation
1 directories scanned
4 image files read

% exiftool tmp -compression -photometricinterpretation -a -G1
======== tmp/Uncompressed.tif
[IFD0] Compression : Uncompressed
[XMP-tiff] Compression : Uncompressed
[IFD0] Photometric Interpretation : RGB
[XMP-tiff] Photometric Interpretation : RGB
======== tmp/CompressedLZW.tif
[IFD0] Compression : LZW
[XMP-tiff] Compression : LZW
[IFD0] Photometric Interpretation : RGB
[XMP-tiff] Photometric Interpretation : RGB
======== tmp/CompressedZIP.tif
[IFD0] Compression : Adobe Deflate
[XMP-tiff] Compression : Adobe Deflate
[IFD0] Photometric Interpretation : RGB
[XMP-tiff] Photometric Interpretation : RGB
======== tmp/CompressedJPEG.tif
[IFD0] Compression : JPEG
[XMP-tiff] Compression : JPEG
[IFD0] Photometric Interpretation : YCbCr
[XMP-tiff] Photometric Interpretation : YCbCr
1 directories scanned
4 image files read

I still don't have time to sit down and sift through the specification to see what warnings should be issued for these files, but at least it is good to have this record of what Photoshop is doing.

  • Phil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants