I ran into this exact issue during testing! I noticed that XYB-encoded images sometimes had a green or desaturated cast, especially on color-managed systems like macOS.

The way jpegli handles this is pretty clever and is designed for maximum compatibility. When you enable XYB mode, it doesn't create a non-standard file. Instead, it:

1) Performs its perceptual magic in the XYB color space internally.

2) Encodes the resulting image data into the standard Y'CbCr channels that every JPEG decoder understands.

3) Attaches a custom ICC color profile to the file.

This gives you the best of both worlds.

On modern, color-managed software (like current browsers, macOS Preview, etc.), the decoder reads the ICC profile and uses it to transform the colors back to perfect sRGB. This is how I fixed the green tint I was seeing—by ensuring the correct ICC profile was always embedded.

On old or non-color-managed software, the decoder simply ignores the ICC profile. Since the image data is already in standard Y'CbCr channels, it just displays it as if it were a regular legacy JPEG. The colors might be slightly off, but the image will still render correctly without crashing or showing major artifacts.

It's a great advancement in color spaces and it's the main reason for creating this pet project, really... Jpegli and XYB seem to be relatively unknown, despite gargantuan coding efforts by the Google Zurich team.

I'm just trying to shed some light on it, mostly!

cjpegli --xyb jpegs seem to have colors significantly (not just slightly) off if the color profile does not get loaded, and there are strong green and/or magenta tints. To test this, exiftool -all= file.jpg seems to do the trick. But even with this tint, images seem to make structural sense and can be understood, so compatibility might be fine anyway.