Make WordPress Core

Opened 8 weeks ago

Last modified 4 weeks ago

#60889 assigned defect (bug)

wide gamut AVIF is desaturated (retagged as sRGB on upload)

Reported by: gregbenz's profile gregbenz Owned by: adamsilverstein's profile adamsilverstein
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Media Keywords:
Focuses: Cc:


So great to see the new AVIF support in WordPress v6.5!

I am seeing one issue with processing images encoded with a gamut wider than sRGB, they are getting desaturated as the the color Primaries have changed from P3 ("SMPTE EG 432-1") to "sRGB or sYCC".

The image should remain encoded in the source gamut when resized/compressed.

Attachments (2)

P3 (25.8 KB) - added by gregbenz 8 weeks ago.
sample after upload via (3.4 KB) - added by gregbenz 8 weeks ago.

Download all attachments as: .zip

Change History (9)

8 weeks ago

#1 @gregbenz
8 weeks ago

May need to log as an ImageMagick bug, not clear where a change may be needed. I see the above results when using:
ImageMagick version number 1809
ImageMagick version string ImageMagick 7.1.1-26 Q16-HDRI x86_64 21914
Imagick version 3.7.0

This ticket was mentioned in Slack in #core-media by antpb. View the logs.

8 weeks ago

#3 @adamsilverstein
8 weeks ago

Hey @gregbenz - thanks for the bug report and for the zip of sample images.

I have read reports of some issues with color profiles AVIF and Imagick that may be related, not sure if/when they were fixed. I'd like to do some more testing and research to see if we can determine if this issue has been reported and/or fixed.

A couple of questions:

#4 @adamsilverstein
8 weeks ago

  • Owner set to adamsilverstein
  • Status changed from new to assigned

#5 @gregbenz
8 weeks ago

Hi @adamsilverstein-

  • The difference is obvious to me visually. You can also confirm details with exiftool by extracting the metadata with the command of the form "exiftool -a -u -g1:3 -w txt testImage.avif" and look at the Color Primaries (around line 35 or so).
  • I don't see a simple way to upload / test via
  • When I change my site to use GD, I also see failure. I'll attach that result as well for reference.

The issue to me appears that an sRGB tag was simply re-assigned to the image without changing the numerical data, resulting in loss of saturation in the rendered image. Had the image actually been properly converted to sRGB, the result would be that the test image would only reduce the saturation of the swatches using the full P3 range (ie 6 swatches would look like 3 after conversion to sRGB, as that would simply clip the colors). Conversion to sRGB would also be an incorrect result, but I mention it as it may point to the root issue involving some request in the code to simply assign a color space tag (via NCLX in this case).

#6 @gregbenz
8 weeks ago

Note that you can visually assess in a color-managed browser like Chrome. The saturation change in the source image is most obvious for red and green in the test image.

This ticket was mentioned in Slack in #core-media by antpb. View the logs.

4 weeks ago

Note: See TracTickets for help on using tickets.