aforeman / grafx2

Automatically exported from code.google.com/p/grafx2
0 stars 0 forks source link

HSL Saturation incorrect for greyscales #396

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Increasing the saturation of a pure greyscale color in HSL-mode will turn the 
gray into red. Grayscales should not be affected.

Original issue reported on code.google.com by annas...@hotmail.com on 30 Oct 2010 at 4:18

GoogleCodeExporter commented 8 years ago
I imagine this can only be a problem with scripting?
Otherwise it is quite useful to be able to turn a gray color into non-gray 
without having to switch to RGB mode.

Original comment by ilija.melentijevic on 4 Dec 2010 at 11:15

GoogleCodeExporter commented 8 years ago
No, it has nothing to do with scripts (I have custom algorithms for HSL etc. 
though so my scripting wouldn't be affected even if it did). This is an error 
and not how a HSL-model should work. You simply can't increase the saturation 
of an image that contains grays without getting erratic results (not that you 
should...I have a superior saturation-script for that ;) ). And I have no idea 
what you mean with usefulness of this bug...but if you're looking for a certain 
effect/feature - I could probably write a script to mimic it, hehe! :D 

Original comment by annas...@hotmail.com on 4 Dec 2010 at 11:36

GoogleCodeExporter commented 8 years ago
Well, I don't know... These sliders have simple additive effect, so if you 
perform S+=25 on color HSL=0/0/172 (light grey) you obtain HSL=0/25/172 
(lightly red-teinted grey), it's not wrong.

If I handled special case that greys have an unchangeable S of zero, it would 
be permanent... you wouldn't be able to "colorize" a grey color while using HSL 
sliders.

Original comment by yrizoud on 8 Dec 2010 at 12:38

GoogleCodeExporter commented 8 years ago
Grey is a special case; It has no saturation and no hue, they cannot be 
increased/changed. You simply cannot add color to greys, they don't have any 
color. Grey 172 is not equal to HSL 0/0/172 - it only has lightness 172, 
nothing else. 

If you now have an image with colors and some greys and you increase the 
saturation - the greys go red and the image is corrupted! It's not how the 
HSL-model works.

Original comment by annas...@hotmail.com on 8 Dec 2010 at 1:19

GoogleCodeExporter commented 8 years ago
For HSL 'mode' and when several colors are selected, I could change the 
behavior of S and L sliders so they are multiplicative, but then:
- greys would be totally impossible to colorize. That's what you want, but for 
some other usages it's a hindrance. With Photoshop color selector, you CAN 
tweak S from zero (greyscale) to max (pure color gradient), why not in Grafx2 ?
- black would stay black, no matter what you do with L (500% of zero is zero).

Original comment by yrizoud on 8 Dec 2010 at 11:41

GoogleCodeExporter commented 8 years ago
Hm, in Photoshop grayscales in images are not affected when adjusting 
H&S...However I do see that the single color-selector works like Grafx2, I'd 
still call this a flawed behaviour.

Let's make this clear: Hue of 0 degrees is RED. Greys have an UNDEFINED hue. A 
color with S=0 and Hue=0 is a gray version of red...NOT TRUE GRAY.

The problem is that a program's interface cannot easily(?) display 'undefined', 
so the program would likely have to keep track of that it's dealing with a grey 
but still displaying the (incorrect) 0 for Hue, as in RED.

Now, take a look at Brilliance and how they solved this:
Adjusting S for a grayscale does nothing...but as soon as you have touched the 
H-slider (even if it still displays 0) you assign a numeric value to H, thus 
it's no longer a grayscale - adjusting S now will have an effect.

Now if this could be implemented it would give us the best of both worlds, 
right?!

Original comment by annas...@hotmail.com on 9 Dec 2010 at 3:23

GoogleCodeExporter commented 8 years ago
I've made a test with the following rule:
When several colors are selected, and at least one of them is non-grey (S>0): 
The S slider doesn't affect the grey colors.

This solves the issue when you want to tweak all palette (doesn't redden greys: 
what you asked for), and it also allows you to select an existing greyscale 
range and "colorize" it.

By the way, what I said about additive system for S and L wasn't true: I had 
implemented a weighted average : +255 sets maximum, +(255/2) sets the average 
of 255 and original value, etc. I found in the code that I commented "This 
makes a better use of the value range 0-255".

Original comment by yrizoud on 9 Dec 2010 at 1:46

GoogleCodeExporter commented 8 years ago
Attached here, please test

Original comment by yrizoud on 10 Dec 2010 at 12:59

Attachments:

GoogleCodeExporter commented 8 years ago
Seems to work fine. All things considered this should be a very acceptable 
solution. :) 

Original comment by annas...@hotmail.com on 10 Dec 2010 at 6:56

GoogleCodeExporter commented 8 years ago
Adopted in r1658

Original comment by yrizoud on 12 Dec 2010 at 6:09