After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 789967 - HSV layer modes don't handle negative values properly
HSV layer modes don't handle negative values properly
Status: RESOLVED OBSOLETE
Product: GIMP
Classification: Other
Component: General
2.9.6
Other All
: Normal normal
: 2.10
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2017-11-06 13:40 UTC by Martin
Modified: 2018-05-24 18:34 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Martin 2017-11-06 13:40:54 UTC
I tried to edit a photo in gimp, but after some steps gimp crashes or the filter does not work:

1) Opening File in Gimp (opens in darktable, close darktable direktly)
2) convert
3) duplicate, invert, mode: "wert(HSV)"
4) create new layer from visible
5) magic lasso to new layer and desaturate
6) gmic "Localvariance normalization"
7) Color -> Values (Gimp crashes)


Here you can find the xcf file:
https://www.dropbox.com/s/iguvkbskkqg2ibl/_MG_8547.xcf?dl=0

In this xcf file the steps 1-6 were already done.

Best regards,

Martin
Comment 1 Ell 2017-11-06 22:33:37 UTC
Sheesh, that's a nice one :)  There's a snowball effect here...

The original image has some pixels with negative components.  The trouble starts on step 3, when you combine the second and third layers using Value mode.  The HSV modes are not really prepared to handle negative RGB components, and in this case this leads to infinite results (layer 4).  On step 5, the output of Desaturate is combined with the input (which has infinities) using Replace mode.  Our compositing code, in turn, is not really prepared to deal with infinities, leading to NaN results (especially, since 0 * inf := NaN).  Finally, on step 7, when you run Levels (not Values; I assume it's Werte), the NaN values cause the histogram (in the Levels UI) to segfault.

The last bit is probably the same issue as bugs 786846 and 788394, which is straightforward.  The other bits are trickier.  In particular, how to handle negative RGB components in the HSV modes (and possibly other HSV code).  While the simplest solution is to clip them, it's worth considering if there's a more intelligent (and meaningful) way to extend them to arbitrary values.
Comment 2 Martin 2017-11-13 14:32:47 UTC
So that means darktable exports an image with negative pixels?
Comment 3 Ell 2017-11-13 16:29:31 UTC
The crash is fixed in master, by commit b2b6552f1fe60ad2f276c537ca4cede3d2a1c362.  The other issues still stand.

(In reply to Martin from comment #2)
> So that means darktable exports an image with negative pixels?

Yes, but, in this case, this only means that those pixels are outside the sRGB gamut.
Comment 4 Michael Natterer 2018-01-01 16:01:52 UTC
Let's put this on the 2.10 milestone, but not as a release blocker.
Comment 5 GNOME Infrastructure Team 2018-05-24 18:34:55 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gimp/issues/1221.