Skip to content

Remove gray ICC profile when relabeling to sRGB - #1533

Merged
olivervogel merged 1 commit into
Intervention:developfrom
davidhirtz:bugfix/gray-icc-profile
Sep 24, 2026
Merged

olivervogel merged 1 commit into
Intervention:developfrom
davidhirtz:bugfix/gray-icc-profile

Conversation

@davidhirtz

Copy link
Copy Markdown
Contributor

NativeObjectDecoder relabels a grayscale image as sRGB but kept its gray ICC profile, which then contradicts the pixels. Encoders embed it anyway; an AVIF written from such an image (YUV420 plus a gray profile) does not decode in Chrome.

The decoder now drops the ICC profile of a relabeled image when that profile's color space (header bytes 16–19) is GRAY. Any other profile is left alone.

Tests (in NativeObjectDecoderTest, building a minimal ICC profile in place of a binary fixture):

  • a grayscale image with a gray profile decodes as RGB without that profile;
  • an RGB image keeps its RGB profile untouched.

Fixes #1532

NativeObjectDecoder relabels a grayscale image as sRGB but kept its gray
ICC profile, which then contradicts the pixels. Encoders embed it, and an
AVIF written from such an image (YUV420 plus a gray profile) does not
decode in Chrome.
@olivervogel
olivervogel merged commit 3ca66a1 into Intervention:develop Sep 24, 2026
6 checks passed
@olivervogel

Copy link
Copy Markdown
Member

Thank you.

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

Successfully merging this pull request may close these issues.

Imagick: grayscale image keeps its gray ICC profile after being relabeled as sRGB

2 participants