grid icon indicating copy to clipboard operation
grid copied to clipboard

Read ExifInteropDirectory

Open paperboyo opened this issue 4 years ago • 2 comments

What does this change?

This reads an additional Exif directory using metadata-extractor: ExifInteropDirectory. It contains only two tags. We only care about one of them: InteropIndex. Together with already read Color Space, it will help us detect images straight from cameras that are in AdobeRGB colour space, but have no embedded ICC profile. It will help us fix this issue.

How can success be measured?

We are ready to gather information needed to fix an issue, ~before we perform the migration.~ (voices of reason rightly recommended a code-frieze until we know how the migration goes…).

Screenshots

image

Who should look at this?

Tested? Documented?

  • [x] locally by committer
  • [ ] locally by Guardian reviewer
  • [x] on the Guardian's TEST environment
  • [ ] relevant documentation added or amended (if needed)

paperboyo avatar Oct 10 '21 00:10 paperboyo

I’m not convinced this is the best way: reading this otherwise useless directory. Maybe instead, we should perform all the needed sniffing and record the outcome in colourModelInformation.DCF-EXIF-impliedAdobeRGB (true, false) or whatever sounds better?

Pseudo-code for FileMetadataReader.scala:

  • if mimeType = Jpeg AND
  • if fileMetadata.icc doesn’t exist AND
  • if ExifDirectoryBase.TAG_COLOR_SPACE = Undefined AND
  • if ExifInteropDirectory."Interoperability Index" = Uknown (R03)
    • set colourModelInformation.DCF-EXIF-impliedAdobeRGB to true
  • else set colourModelInformation.DCF-EXIF-impliedAdobeRGB to false (or drop whole key? seems worse option)

And then one day, use this new value to apply AdobeRGB colour profile while creating thumbnails and crops (because we currently can’t for live preview).

paperboyo avatar Jan 19 '22 03:01 paperboyo

At least with my Nikon DSLR, the JPEGs provide all necessary information to reconstruct an AdobeRGB profile:

  • TIFF WhitePoint (IFD0) = ...
  • TIFF PrimaryChromaticities (IFD0) = ...
  • Exif ColorSpace (Exif IFD) = Uncalibrated
  • Exif Gamma (Exif IFD) = 2.2

Just shove the white point, chromaticities, and gamma curve into your CMM, you'll get Adobe RGB.

More information: https://ninedegreesbelow.com/photography/embedded-color-space-information.html

pjanx avatar Jan 24 '24 14:01 pjanx