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

Read ExifInteropDirectory #3497

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Read ExifInteropDirectory #3497

wants to merge 4 commits into from

Conversation

paperboyo
Copy link
Contributor

@paperboyo paperboyo commented Oct 10, 2021

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?

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

@paperboyo paperboyo marked this pull request as ready for review October 16, 2021 16:52
@paperboyo paperboyo requested a review from a team as a code owner October 16, 2021 16:52
@paperboyo
Copy link
Contributor Author

paperboyo commented Jan 19, 2022

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).

@pjanx
Copy link

pjanx commented Jan 24, 2024

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

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

Successfully merging this pull request may close these issues.

Colour wrong for images only tagged via DCF EXIF
2 participants