This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Unusual Output from Levels Filter in Krita

Tags: None
(comma "," separated)
jhollobon
Registered Member
Posts
2
Karma
0
Hi all,

It seems to me that the behaviour of the Levels filter in Krita doesn't conform with the expected behaviour of such a filter.

Here's a simple demonstration of the issue. Take the following 8-bit RGB image:

Image

Note that it includes large dark areas (most pixels have a value of less than 50%).

Now apply a Levels filter (under Filters > Adjust > Levels..., or Ctrl + L), and drag the minimum input level to the midway point (i.e. 127), like this:

Image

One would expect all pixels with a Value of 127 or less to be clipped to black. And pixels with a Value from 128-255 should be re-mapped to the output range (in this case, 0-255).
So the result should look like this:

Image

And that's the result I get from the Levels filter in every other image manipulation software I've tried, including Gimp, Photoshop, Affinity Photo, Inkscape, and even compositors such as Fusion.

But Krita's output is the odd one out. None of the dark areas have been clipped, and all the details in the bottom half of the image are still visible:

Image

(Note that the difference seems somewhat subtle here, due to the small image size. It's more obvious, with larger images).

I suspect that there may be a bug in the Levels filter code, related to how the separate colour channels are processed, because desaturated images seem to produce the correct result.

Obviously this example is just for demonstration purposes, and I could work around it by applying a color curve like this, instead:

Image

But in practice, that work-around starts to fall apart when you need to make non-trivial adjustments.

I'm kind of surprised no one else has brought this up. Even if the current behaviour is intentional (which I doubt), I find it way less useful than the industry-standard behaviour.

I know that I should at least attempt looking into the code myself, rather than asking the Krita developers to. But it would be good to start by getting some feedback – has anyone else noticed this issue? Can anyone suggest other work-arounds?

Having said all that, I'm a big fan of Krita, and would like to extend my congratulations to everyone who has worked so hard to produce something truly fantastic. Thank you, and keep up the great work!
User avatar
halla
KDE Developer
Posts
5092
Karma
20
OS
Hm, we've only got two bugs about the levels filter:

https://bugs.kde.org/show_bug.cgi?id=376048 ( Filter "Levels" wrong histogram)
https://bugs.kde.org/show_bug.cgi?id=374726 (The levels filter does not have a channel selector)

I do see that gimp 2.8 and Krita 4.1.1 do something different, and I suspect that's because Krita converts the image to LAB and modifies the L channel, and Gimp to HSV and modifies the Value channel.

Please make a bug report.
jhollobon
Registered Member
Posts
2
Karma
0
Thanks for responding, and for those links. Your comment about Krita using LAB sounds spot-on to me.
I've created a bug report, as you suggested, and tagged it as 'minor'.


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], markhm, rblackwell, sethaaaa, Sogou [Bot], Yahoo [Bot]