Willow
Willow copied to clipboard
Greyscale images with ICC color profiles that are output as AVIF renditions display incorrectly in Firefox
This one's a really obscure issue, and I'm not actually sure why the combination of greyscale + color profile causes this, but I have example files to show it in action.
The issue appears to be that Firefox still doesn't support grid-based AVIF files in its AVIF renderer, despite the bug being active for almost 4 years. The ultimate source of that problem is that Firefox uses mp4parse-rust as its AVIF renderer, and that doesn't support grid-based AVIFs. This issue on pdn-avif may also shed some light on the underlying problem.
To see Firefox's grid
issue in a non-Wagtail environment, go to https://0xc0000054.github.io/pdn-avif/using-image-grids.html and click the "Image grid example.avif" link in the second section. In Chrome, it'll display the same 1/2/3/4 image seen below the link. In Firefox, you'll get an error message.
I've also attached three files to this issue that can be uploaded to a Wagtail site to show off how greyscale + color profile makes Willow render the AVIF in a way that breaks in Firefox.
This image, which is a greyscale jpeg with an ICC Color Profile of "Dot Gain 20%" triggers the render bug:
This image, which is a greyscale jpeg with no ICC profile, does not trigger the bug:
(Note that, if you flip between the above images, you'll see that the one with no profile is dramatically darker)
This image, which is an RGB jpeg with an sRGB color profile, does not trigger the bug:
(This image looks identical to the original one with the color profile intact)
Upload these three to a Wagtail site that's configured to display renditions as AVIF, and you'll see that the first one displays wrong in Firefox:
I'm not 100% sure that this problem is actually with grid
-based AVIFs, because I don't know how to determine if the broken one is actually a grid
-based AVIF, but it seems likely.
My one clue about a potential fix for this is that pdn-avif issue that I linked. Apparently, using a "very slow" preset for the AVIF rendering step would prevent the image from being generated as a grid
, and thus prevent the image corruption. Maybe that's something that Willow could do when it runs into a greyscale+color profile image that it's being asked to render as AVIF?