How to cope with colours going out of gamut?

Thanks Glenn, I think I sort of hijacked this thread a bit. I’m not working with a “captured” image/photo/raw file. I’m tweaking an sRGB painting progam (MyPaint). So I’m taking an sRGB color (a selected brush color) and converting that to CIECAM values, tweaking one or more CIECAM dimensions, and taking that new CIECAM color back to the sRGB gamut by reducing the Chroma (if necessary).

Ah, need to read the whole thread… :smiley:

Yes, I’m not sure where to go with your particular canvas, so to speak. I do appreciate the opportunity to write what I did, however; it helped me coalesce some of the concepts I’ve struggled to grasp of late into a bit of understanding.

Back to the current programming…

1 Like

I updated my logic to just 10 iterations and using an exponential reduction method that seems to very quickly find a very close match even if the original color is wayyyy out of gamut:

https://github.com/briend/mypaint/blob/HCYtools/lib/color.py#L1087-L1114