@s7habo Boris
I’m afraid a perfectly hue-preserving gamut compression probably does not exist. Even if it did, and we solved the display profile influencing the histogram, maintaining hue in the Luv (LCH_uv) or JzAzBz scope does not guarantee maintaining perceptual hue (all such spaces are approximations of human vision).
Your rose, after agx, fits nicely into Rec 2020. I’ll set my histogram profile to ProPhoto, and demonstrate the effect of the display profile by merging screenshots of the vector scope in difference mode. ProPhoto vs Rec 2020 as display profile shows a few stray pixels if heavily stretched (same stretch as below for Adobe RGB vs sRGB):
This is as expected: no out of gamut pixels altered by the display profile.
Prophoto vs sRGB as display profile, difference mode at 80% opacity, no stretching:
A slightly larger space, Adobe RGB vs ProPhoto:
sRGB vs Adobe RGB displays a small difference:
Heavily stretched:
So, even if we managed to find a perfectly hue-preserving gamut compression method, turning it on after you edited your image will shift the colours, as the display profile will no longer modify the hue (either by clipping away the negative values, or by applying a perceptual LUT).
Using JzAzBz in the gamut compression code (note: this currently compresses all colours, not only the most saturated ones), the hue angle is stable if I use Rec 2020 for the display profile (the vectorscope itself is in JzAzBz mode, so that’s expected). No compression vs compression (the compression was set so that pixels were pulled inside the sRGB gamut):
If I restore sRGB as the display profile, then no compression vs same compression as above – the display profile shifts out-of-gamut colours:
Rose without gamut compression (the sRGB display profile clips negatives) vs. fixing negatives by JzAzBz gamut compression:
Comparing hue angles of the gamut-compressed rose, using sRGB and Rec 2020 as the display profiles – since all pixels are within the gamut, the display profile does not clip anything, and the lines coincide:
Difference (histogram profile set to Rec 2020), again very heavily stretched):