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 527085 - Hue/Saturation (working improperly)
Hue/Saturation (working improperly)
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Tools
2.4.x
Other All
: Normal normal
: 2.6
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2008-04-09 08:10 UTC by Michael Deal
Modified: 2012-06-01 16:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Original Image (28.79 KB, image/png)
2008-04-09 08:10 UTC, Michael Deal
  Details
GIMP (w/ 50% overlap, and -30 hue shift to the reds) (30.21 KB, image/png)
2008-04-09 08:11 UTC, Michael Deal
  Details
Photoshop (w/ 50% overlap, and -30 hue shift to the reds) (31.46 KB, image/png)
2008-04-09 08:11 UTC, Michael Deal
  Details
find nearest hue when overlap (1.23 KB, patch)
2008-04-17 22:54 UTC, Damien Profeta
committed Details | Review
gimp-gegl-hue-saturation-fix-2008-09-06.patch (1.91 KB, patch)
2008-09-06 06:55 UTC, Martin Nordholts
committed Details | Review

Description Michael Deal 2008-04-09 08:10:09 UTC
This bug pertains to adjusting an image in GIMP using the Hue-Saturation module (adjusting a specific color... not the master). When you adjust the hue, it seems the overlap works correctly in only one direction. E.g., if you're increasing the hue of the Red's the overlap looks correct counter-clockwise, however, incorrect clockwise... And if you decrease the hue, the opposite happens.

It's hard to notice the bug when running the filter on a regular image, but if using an image composed of the entire spectrum -- you start to notice a difference! Photoshop seems to handle this color wrapping properly.
Comment 1 Michael Deal 2008-04-09 08:10:38 UTC
Created attachment 108910 [details]
Original Image
Comment 2 Michael Deal 2008-04-09 08:11:14 UTC
Created attachment 108911 [details]
GIMP (w/ 50% overlap, and -30 hue shift to the reds)
Comment 3 Michael Deal 2008-04-09 08:11:37 UTC
Created attachment 108912 [details]
Photoshop (w/ 50% overlap, and -30 hue shift to the reds)
Comment 4 Sven Neumann 2008-04-10 08:14:17 UTC
This does indeed look like a bug in our code.
Comment 5 Damien Profeta 2008-04-17 22:54:48 UTC
Created attachment 109459 [details] [review]
find nearest hue when overlap
Comment 6 Damien Profeta 2008-04-17 23:00:50 UTC
The bug exists also in 2.5 with normal code and GEGL code. 
I've made a patch (above) for current svn version for normal code. 
The correction is done when two hue are mixed. Instead of making it linearly, it checks what is the shortest path on the hue circle and adapt value to choose this path. 

I hope this is what is expected.
Comment 7 Michael Deal 2008-04-17 23:16:11 UTC
Just tested the code you submitted, and am happy to say, it works perfectly now! Thank you :)
Comment 8 Michael Deal 2008-04-18 08:19:22 UTC
So, how does this go about being added to the latest build?
Comment 9 Michael Natterer 2008-04-18 08:42:03 UTC
Looks reasonable, will try this and apply the same to the gegl operation
if it's correct.

And Michael, there is no reason to push us. I was in fact writing this
comment while I didn't see yours yet.
Comment 10 Michael Natterer 2008-04-18 08:55:39 UTC
Why did you close this bug as FIXED? Reopening.
Comment 11 Michael Deal 2008-04-18 09:03:04 UTC
Sorry, I'll be sure to read the bugzilla manual more thoroughly.

Just trying to become more involved, perhaps a bit over eager. I put a few hours into attempting to crack the bug, so was happy to find someone else had figured out the solution.
Comment 12 Michael Schumacher 2008-04-18 11:12:22 UTC
Bugs do get resolved as fixed if the code that fixed them has been committed to the subversion repository.
Comment 13 Sven Neumann 2008-04-28 14:48:27 UTC
I have committed this change to both branches:

2008-04-28  Sven Neumann  <sven@gimp.org>

	* app/base/hue-saturation.c (hue_saturation): applied patch from
	Michael Deal that fixes use of the overlap option (bug #527085).

Leaving open as we still need to correct the GEGL code path.
Comment 14 Sven Neumann 2008-05-27 08:21:37 UTC
Moving this to the 2.6 milestone as the problem has been addressed in gimp-2-4.
Comment 15 Martin Nordholts 2008-09-06 06:55:01 UTC
Created attachment 118147 [details] [review]
gimp-gegl-hue-saturation-fix-2008-09-06.patch

For reference, here is the patch I commited with the fix ported to the GEGL operation.
Comment 16 Martin Nordholts 2008-09-06 06:55:34 UTC
2008-09-06  Martin Nordholts  <martinn@svn.gnome.org>

	Bug 527085 – Hue/Saturation (working improperly)

	* app/gegl/gimpoperationhuesaturation.c
	(gimp_operation_hue_saturation_process): Properly map the
	secondary hue. Based on patch by Michael Deal.
Comment 17 strata_ranger 2012-06-01 16:05:08 UTC
I have discovered some cases where the patch actually causes the tool to operate incorrectly.

Take adjustments of:
- Cyan: Hue + 120º
- Blue: Hue - 120º
- Overlap: 100%

This is a 240º difference between the two channels (hue and secondary_hue), making it appear to be the "long way" around the HSV circle, but it's actually NOT:

- Cyan + 120º = Magenta
- Blue - 120º = Green
- Actual difference: 120º

The overlap region should show a magenta-blue-cyan-green gradient in this case, but GIMP actually paints it with a magenta-red-yellow-green gradient instead.  Whoops!

Alternate example:
- Cyan: Hue + 180º
- Blue: Hue - 90º
- Overlap: 100%

Slowly adjust the Blue channel all the way down to -180º and note a sudden appearance of an HSV band in the blue-magenta range that shouldn't even be there.  Adjust the Blue channel back to 0 and note a sudden appearance of an HSV band in the cyan-blue range.

I can't think of any actual cases where these would occur "in the wild", but they can be made to occur in theory and the sudden manner in which it occurs strongly implies it's incorrect.

See also bug #644032, which might be related but is alive and well in the 2.8 release.