Bug 380327 - HSV blending modes do not correctly handle source saturation
Summary: HSV blending modes do not correctly handle source saturation
Status: RESOLVED WORKSFORME
Alias: None
Product: krita
Classification: Applications
Component: Color models (show other bugs)
Version: 3.1.2
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-29 21:47 UTC by Michael
Modified: 2017-06-06 09:46 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Overview of wrong (Krita) and correct (Gimp) HSV blending (641.06 KB, image/png)
2017-05-29 21:47 UTC, Michael
Details
4 way comparison of the HSL Color blending mode in Gimp, Krita and Photoshop (1.01 MB, image/png)
2017-06-06 08:08 UTC, Halla Rempt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael 2017-05-29 21:47:05 UTC
Created attachment 105766 [details]
Overview of wrong (Krita) and correct (Gimp) HSV blending

The result of blending a color-layer and value-layer with HSV layer blending modes "HSV Color" and "HSV value" appears to be not correctly calculated (maybe similar issues with HSL, HSY...).

To be: In the Krita result of the attached overview (top right figure), vertical y-axis slices (like the orange line) should represent gradients with same hue+saturation and increasing value from top to bottom. Like it is correctly implemented in Gimp (top center figure). Saturation and value in HSV mode are independent of each other. Value refers to the MAX(r, g, b) while saturation determins the ratio between MIN(r, g, b) and MAX(r, g, b). The value affects all RGB channels proportionally (multiply).

As is: Instead of constant saturation over the whole vertical slice, the saturation in the top part is all 100% and decreases from a certain point towards the bottom from 100% to 0%. The extracted saturation channel (right figure) illustrates the problem, where the whole top left half of the demo setup composition is 100% saturated, which not at all corresponds to the initial redscale color gradient.
Looking at the change in RGB values along the orange section of top right figure from bottom (white) to top (black), the absolute values are reduced in parallel, more or less by the same amount (subtract). I suppose here's a problem in the formula, as the ratio between R, G and B should be constant.
Comment 1 Halla Rempt 2017-06-06 07:59:26 UTC
Hm... Gimp's Color blending mode actually doesn't use HSV but HSL: Krita has HSI, HSL, HSV and HSY Color blending modes. It would kind of help to have your exact test file here, because everytime I draw a gradient it is subtly different.
Comment 2 Halla Rempt 2017-06-06 08:08:51 UTC
Created attachment 105941 [details]
4 way comparison of the HSL Color blending mode in Gimp, Krita and Photoshop

I'm not convinced it's not gimp that's wrong. I created a file similar to your example in gimp and saved it as psd and xcf. I loaded the xcf and psd in krita, and the psd in photoshop. The xcf and psd show the same in Krita; and Photoshop shows the file the same as Krita, not as Gimp.
Comment 3 Halla Rempt 2017-06-06 09:46:27 UTC
Extra complication: Krita and Photoshop's Color mode (without suffix) is HSY. Photoshop takes it from the Adobe PDF spec, just like it's defined for svg and css, while Gimp is kind of "original"...