imagej2 icon indicating copy to clipboard operation
imagej2 copied to clipboard

TIFF and PNG import ignores embedded ICC color profile => wrong colors in non-sRGB images

Open DerAndere1 opened this issue 5 years ago • 1 comments

Environment (Fiji Is Just) ImageJ 2.0.0-rc-69/1.52p; Java 1.8.0_172 [64-bit]; Windows 10 10.0; 80MB of 5876MB (1%) SCIFIO version: 0.37.3

The same issue was reported in the upstream SCIFIO issue tracker: https://github.com/scifio/scifio/issues/401)

Steps to reproduce

  1. Use 3rd party software (GIMP 2.10.14) to create an sRGB image without alpha-channel, with the following ICC color profile: sRGB (with sRGB tone reproduction curve). Export with embedded ICC color profile as a) TIFF (no compression) or b) PNG (no compression)
  2. Use 3rd party software (GIMP) to convert a copy of the image from step 1 to the Rec2020 color space and export the image in that color space with the respective Rec2020 ICC color profile (https://github.com/ellelstone/elles_icc_profiles/blob/master/profiles/Rec2020-elle-V4-rec709.icc) embedded.
  3. Run FIJI/imageJ2 in modern mode, enable "use SCIFIO when opening files".
  4. In FIJI/imageJ2, import the images from steps 1) and 2) using a) "File -> Open" b) "File -> Import... -> SCIFIO" followed by "Image -> Color -> Make composite", select "Display mode: composite", click "Ok". c) "File -> Import... -> BioFormat". Open as hyperstack. Then continue as in step 4b)

Expected behaviour: The info about the correct primaries and tone reproduction curve (TRC) from the embedded ICC matrix profile should be used to ensure that all test images are displayed with almost identical colors within FIJI

Actual observation The Rec2020 image from step 2 is displayed with wrong colors. The observed colorshift can be exactly traced back: The ICC profile information is completely ignored and FIJI wrongly assumes sRGB (with sRGB TRC) as the image color space. Note: The sRGB image from step 1 is displayed with correct colors.

DerAndere1 avatar Dec 17 '19 00:12 DerAndere1

The issue is critical for linear images like images in the scRGB color space (embedded scRGB color profile with linear TRC). Open the attached tiffs in FIJI and observe the differences in gray tones. color_profiles_issue.zip

The relevant standard for ICC color management is ISO 15076-1:2010.

A a workaround limited to images in AdobeRGB or Prophoto RGB (aka ROMM) color space with embedded ICC profile (equivalent to AdobeRGB or Prophoto RGB, respectively):

  1. Install the Color Transformer 2 plugin
  2. Install the ij-plugin_toolkit by jsacha.
  3. 3rd party software can be used to determine the original image's color space from the embedded ICC color profile.
  4. The image has to be opened in FIJI/ImageJ2 as discribed in in the initial bug description.
  5. "Image ->Color -> Split channels"
  6. "Image -> Stack -> Images to stack"
  7. "Image -> Color -> Stack to RGB"
  8. "Plugins -> Color Transformer 2". Set "From color space:", choose the source color space of the origina image file. Set "To color space:", choose "Lab". Disable "Covert images to RGB color (8bit)". Keep enabled "Display full 16 bit range". Click "Ok"
  9. "Plugins -> Color -> Lab* stack to RGB".

DerAndere1 avatar Dec 17 '19 00:12 DerAndere1