Jump to content

Talk:HSL and HSV/Archive 6

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Archive 1Archive 4Archive 5Archive 6

"the key of HSV"

one part of the RGB cube to demonstrate how to understand HSV's components C.
hexagone is formed through projection from RGB CUBE.

I just research a long time to get the key of HSV .I just submit my result here. I think many people need to understand the idea about color spaces and modules. although it somewhat hard to imagine the gemoetry module ,but at last I got it . I hope to help those who are not clear about this porblem.

In order to prove why chroma is defined as “C=max-min”, I intended to give a diagram to show the principle as below.

  1. Assume a vector a(0.1,0.2,0.3) , each component subtracts the minimum 0.1 , it becomes like vector b(0,0.1,0.2) . a and b only differentiates in one vector (0.1,0.1,0.1), when the vectors project to the plane along the axis “wk”, they pass the same point P. C is defined kp/kp’ (ratio of the radius of two hexagons), in fact ΔKPF∽ΔKP’B, so KP/KP’=KF/KB. Because the projection can preserve the ratio between edges and angles in plane hexagons and KBCG. so lets transport to plane KBSG, ΔKQH∽ΔKBQ’,KQ’ corresponds to KP’ in hexagons. QH corresponds to FP. So we get equation like this: KH/KB=KQ/KQ’ =KP/KP’ , every body knows KH is just MAX-MIN. and KB=1. so KP/KP’=C= MAX-MIN.
  2. Furthermore, notice that changing the median component moves in the projection plane along the direction of the hexagon through the current point, while changing the minimum component moves us along a radial line. Notice vector c is changed just the median component , it’s end run along HH’ ,just equal to FF’ in hexagon . and vector d is just changed the minimum component ,so it changes in both direction in KBCG plane. Ps. Vector b, c, d are the results by changing their median or minimum value and then subtract the minimum. It means b,c,d already transport into the plane KBCG rather than the original form. Notice c’ ,d’ are the projected vector from plane KBCG.
  3. Exactly, we can use another method to get the formula of HSV etc.

Any color like RGB(max,mid,min) can be changed to (max-min,mid-min,0) then change it to standard hue color like (255, (mid-min)/(max-min)*255,0). It is more easy to understand why hue’s formula is like this.

qduwg@163.com

I don’t understand what your first diagram is trying to show, and I don’t understand the purpose of your comment. Are you asking a question? Suggesting a change to the article? For what it’s worth, your point #1 seems to indicate that you understand just what’s going on here. The article’s explanation is HSL and HSV#Hue and chroma. –jacobolus (t) 19:47, 30 January 2013 (UTC)
From your words I can be aware of a bit uneasy. I suerly KNOW the article's explanation is HSL and HSV#Hue and chroma. I have already studied your article many times. Do you think that I don't know your articles??
1) you dong't understand the first diagram what to show.
I just select one plane from RGB cube THEN project to the hexagone. Using one plane is more clear for talking.
2) "Are you asking a question? Suggesting a change to the article?"
I just saw HilbertHilbert want you to explain this questions via geometry method. your comment is so abstract for that we are not a professor in graphic. I simply give out a diagram for them. so many people sugguest you give some geometry explaination, but you don't give. So I don't give any suggetion, useless! (quoted from HilbertHilbert:chromaticity diagram:Second: will someone please explain how one gets from the RATIO of the lengths of the vectors OP/OP' in the chromaticity plane, to the arithmetic difference between the max and the min of (R,G,B)?— Preceding unsigned comment added by HilbertHilbert (talk • contribs) 03:19, 29 June 2011 (UTC)
If my comment offends you, pls forgive me. you're a bit madcap or arbitrary. you're a professor in graphic field, I think you can understand my comment. but I think it better to be canceled from here.
thank you! (–user:Qduwg)
Hi Qduwg, I think you misunderstand me. I’m not offended or upset, I just don’t understand what your intention is. I was just saying I think your point #1 said something fairly similar, in terms of the geometry, to what was said in that section of the article. So it sounds like you understand what’s going on. I’m not a professor, and I’m not quite sure what you mean by “madcap or arbitrary”. I’m just some guy on the internet trying to help explain stuff. :-) Anyhow, thanks for trying to help answer HilbertHilbert’s question with your diagram. I still can’t quite figure out what it shows, but perhaps someone will find it clarifies the explanation. –jacobolus (t) 05:54, 31 January 2013 (UTC)
Thank you so much Dear jacobolus. My intention is very simple, i just give out a prove progress according to my own opinion. Maybe it can help somebody who have some puzzle . You know this color cube module is so hard to imagine. I just use only one plane to demenstrate this problem rather than the whole cube. The purpose is just making it be more clear for reader to observe and study the geometry relation between these edges and triangles. Maybe my drawing is not so perfect ,but the connotation or meaning all is expressed. If someone study deeply , he can read out the implication in it just like me did. Only need is a good imagination! thanks. :) Qduwg (talk) 05:29, 1 February 2013 (UTC)

Formula for X

Can’t X(H prime) be simplified? Isn't the same as  ? Yurivict (talk) 00:16, 4 April 2012 (UTC)

Nope. Try plotting them. –jacobolus (t) 01:32, 4 April 2012 (UTC)
What is mod 2 in the formula? — Preceding unsigned comment added by 74.190.149.81 (talk) 01:26, 4 May 2012 (UTC)
Got it now. thanks jacobolus for the graph: Try plotting them — Preceding unsigned comment added by 74.190.149.81 (talk) 01:33, 4 May 2012 (UTC)
That's because Mathematica implements mod 2 for floats as well. Not all programming languages have this. In the Wikipedia section of mod, it only discusses integer mod. Angry bee (talk) 06:17, 22 December 2012 (UTC)
The formulas shown in this article are not supposed to be ideally efficient programming language implementations, but rather mathematical descriptions. I recommend using conditional statements when actually implementing this in code, though most programming languages also have a mod operator for floats, so that’s also an okay implementation. Ideally, test various implementations in your language of choice, profile them, and choose the one which is best trades off readability and efficiency. Cheers. –jacobolus (t) 22:14, 22 December 2012 (UTC)
My point is that mathematical description as described in modular arithmetic only deals with integers although it has a functional description that allows it to extend to floats. The use of mod here in the article is extended to floats. For clarity it should mention that mod 2 is mod 2 over the reals. Angry bee (talk) 19:29, 23 December 2012 (UTC)
Okay. Put it in one of those lettered footnotes if you want. No one else has said they were confused about this. –jacobolus (t) 00:34, 29 December 2012 (UTC)
It is confusing, especially that all modulo descriptions on Wikipedia mainly talk about integer arithemtics. It can be even more confusing for software developers who are used to integer arithmetics, so I agree the article should clarify this. — Preceding unsigned comment added by 95.171.201.200 (talk) 20:55, 31 March 2013 (UTC)
What do you mean nobody is confused? I was confused and so was that other user. And we are the ones who actually cared enough to say something. Imagine the countless others who are as well. I personally don't care about compact notation when clarity should be the most important factor. 108.35.42.170 (talk) 06:45, 4 July 2013 (UTC)
Are you kidding me? Is Mathematica an authority on math notation now? — Kallikanzaridtalk 16:38, 31 May 2013 (UTC)

I don't know why here H' mode 2? I think it is not symmetrical derivation progress to the definition HSV's H component. Please explain why? I calculate the X (here i define varible "mid" as X)according to the definition formula like this(e.g R is max):

H'=(mid-min)/(max-min) min=V(1-S) max=V, so we can get mid=V-C+H'C, then we write the last result :(MAX,MID,MIN) =(V,V-C+H'C,V-C),SO,each component can sub the MIN, we get (C,H'C,0).

How we can decide X=H'C need to be written as X=C(1-|H'MOD 2 -1|)?? WHAT'S THE PURPOSE writing like this?

thank you! — Preceding unsigned comment added by Qduwg (talkcontribs) 07:27, 30 January 2013 (UTC)

The purpose of writing it that way is that it’s the clearest and most compact expression of the form of the quantity X in terms of C and H. The ratio of X to C varies with the hue like a sawtooth shape. Try plotting it. –jacobolus (t) 19:47, 30 January 2013 (UTC)

Historically from 1986 on, I've (IME) mostly seen HSB resemble your depiction of HSV (not HSL)

Dusting off an old memory here.

If you do a google *image* search on "HSB color model", you'll see that there are many references to HSB as the single cone model. In other words, "Brightness" is strictly the distance from black. Full brightness does not collapse to decreased saturation as it does with HSL. Not full saturation at halfway up.

(Not my image....:) http://albertociammaricone.files.wordpress.com/2010/09/color_hsb.jpg

FWIW, this is also what the original Adobe postscript specification indicates. In fact, I would have sworn that I've seen HSV as the double cone model before, but I can't seem to find my eons old original Foley & Van Damme to verify if this is where I saw it (if anyone has one, I'd love to see what it says). Thanks for humoring me!  :) Tgm1024 (talk) 13:21, 24 June 2013 (UTC)

First, your diagram is entirely consistent with the text in the introduction, “HSV stands for hue, saturation, and value, and is also often called HSB (B for brightness).” Note that this article calls the “single cone model” by the name “HSV”.
But second, in reading hundreds of sources (academic papers, patents, old software manuals, the labels used in software itself, etc.), this was the typical usage I found, but there was incredible variety and certainly some sources that used these abbreviations differently. This is why I included this sentence in the introduction: “However, while typically consistent, these definitions are not standardized, and any of these abbreviations might be used for any of these three or several other related cylindrical models.”jacobolus (t) 01:56, 5 July 2013 (UTC)


Roborealm's HSL and HSV is different

In the machinevision/image processing/video processing software called RoboRealm, you will find that that its Hue wraparound point (360deg to 0deg point) is aligned with the Blue channel, as opposed to the Red channel shown in the Wikipedia article here. Is this a valid implementation of HSV and HSL? Or is it incorrect? If it's not correct, I'm not sure if they've fixed it yet, as I'm using and sticking to using the free but much older version of the software (the most recent versions are commercial software, the older version I have was distributed as freeware). But yeah, I'm not sure if having it wraparound on blue is actually considered a "bad" implementation or not. Animedude5555 (talk) 00:53, 24 August 2013 (UTC)

Yes, there are several slightly different variants in use, especially in software from 10-30 years ago. There’s no real “correct” or “incorrect” model [to be honest all of these models are pretty terrible for most uses]. What’s described here are merely the most common/popular implementations. –jacobolus (t) 06:43, 10 September 2013 (UTC)

Rec. 709 luma sRGB values

User:Jacobolus reverted my recent edit, saying in his edit summary: „the former numbers were deliberate: these are the ones in common use for this color model in software packages [and now e.g. proposed as web standards]“. It’s about former

versus

from the sRGB and Rec. 709 articles. (I have not checked the actual specifications.)

Since the latter would be consistent with other articles, I’d like the rounded values to be better sourced (Adobe?). In my humble opinion, WP articles should prefer precise values even if they are only used in theory, not practice. They shouldn’t be too verbose in supplementary articles, though, but 4 sigfigs aren’t.

I don’t know which particular web standards are meant (SVG, CSS, HTML …?). They usually just reference sRGB (or maybe scRGB), but I found an instance of actual values in filter effects, although either rounded to 3 sigfigs (neither 2 nor 4) or off:

(Lindbloom, Bruce. "RGB Working Space Information")

Further research shows that the 2-digit approximations for Rec. 601 (NTSC) values in the article are what Adobe products are using and, as a sidenote, UHDTV uses different values:

Christoph Päper 19:02, 9 September 2013 (UTC)

Two points. (1) Including the Rec 709 primaries in this article is only for reference/comparison with the Rec 601 versions, and using more digits of precision beyond any person's ability to optically discriminate is entirely unnecessary. The previous 2-digit values are fine. [Someone who is curious about this subject can easily find out more precise values if they need them.] (2) They only need to be mentioned once, rather than repeated along with the Rec 601 values, which are actually used in software. The software I've seen (Adobe products, other graphics software trying to emulate adobe products, and now Adobe's proposed web standard) in general explicitly uses 0.30 * R + 0.59 * G + 0.11 * B. Other values are not particularly relevant for someone who is just trying to figure out how those work. In general anyone implementing such things for brand new software should either stick to what’s being used, or use a better color model in general than any of these. Therefore, the changes you made Crissov are in my opinion not helpful in the context of this article. If you can find a source which uses rec 709 primaries / sRGB as the basis of some hue/chroma/lightness like color model though, then I’d be happy to change my mind in the light of evidence. –jacobolus (t) 06:37, 10 September 2013 (UTC)
Oh, I just clicked on your links. I hadn’t ever seen that feColorMatrix filter in SVG before. Is that supported by browsers? Used by any content? I’ve never heard of it or seen it in use. But it looks interesting. Okay, if we cite that as a source, then maybe it’s reasonable to also include the Rec 709 primaries where you want to add them. –jacobolus (t) 06:51, 10 September 2013 (UTC)
I had been talking about this spec which uses the Adobe versions – http://dev.w3.org/fxtf/compositing-1/ – but you’re right that SVG and now this part of CSS http://dev.w3.org/fxtf/filters/ uses the Rec 709 versions. Kind of annoying for content creators to have these behave differently. Yay standards. –jacobolus (t) 07:02, 10 September 2013 (UTC)

Materialscientist’s refs/bibliography changes

Hi Materialscientist. I’m curious why you think it’s better to skip the parenthesized years in pointers to “Further reading” sources, why you want to rename “Further reading” to “Bibliography”, why you want to increase the number of footnotes listed after several paragraphs when the previous ones were perfectly fine at linking to the proper places, why you want to remove ending page numbers from pointers to journal articles, why you want to remove some of the pointers to further reading sources, why you want to remove all the line breaks from inside footnotes, etc. As far as I can tell every one of these changes makes the references uglier and harder to follow, makes the overall formatting inconsistent, and is a basically completely unnecessary change, just churn for the sake of churn, edits for the sake of making edits. But there’s perhaps some benefit I’m not seeing? Cheers. –jacobolus (t) 08:40, 20 September 2013 (UTC)

The goal was to provide direct link to sources, within the page and on the web, in one-two mouse clicks. The rest are minor details, and a lot of typing, thus the asumption of "edits for the sake of making edits" is utterly wrong. Formatting could be more consistent, but I didn't want to ruin the previous style (which is too editorializing for encyclopedia though - we can't advise; we can't add analysis of sources, which is still present in "Bibliography" and should be removed; we can't use wikiarticles as sources and thus shouldn't refer to "references in other articles"). Wikipedia is very liberal for citation styles, and I follow publishers conventions: one source per foot note - this not crucial, but this allows reusing one source, which is impossible if they are bundled. Use clear titles: "Further reading" was listing actual references, whereas it should stand for independent sources. I'll gladly answer further specific questions. Materialscientist (talk) 08:52, 20 September 2013 (UTC)

Did I break something?

I tried to edit something here to fix something I thought was in error, but now I think something is missing. There appears to be a large white gap this wiki article, where I believe there was some text before. Benhut1 (talk) 13:59, 21 January 2014 (UTC)

I’ll take a look. But the previous text was fine. It’s a transformation from hexagons to circles. I reverted your edit. Does that fix whatever other issue you noticed? –jacobolus (t) 05:13, 27 January 2014 (UTC)

Circles to Hexagons or Hexagons to Circles?

The description of hue, where it describes the transformation as warping hexagons into circles. Maybe I'm not looking at it from the right point of view, but it seems to me that it is actually warping circles into hexagons. From my understanding, the HSL, HSV, and HSI color spaces are defined in terms of cylinders or cones, who's cross-sections are circles, not hexagons. As such, any color in one of these HS color spaces can (for any given value of L, V, or I) be thought of as being a particular point on a circular plane. However, since computer monitors are RGB devices, in order to properly represent an HSL, HSV, or HSI color in RGB color space, the circles of the HSL, HSV, or HSI color space must be first converted into hexagons in RGB color space (these hexagons are in fact cross-sections of tilted cubes, where the cube is the RGB color space cube). Therefore, calling the transformation a circle to hexagon transformation is most appropriate for talking about representing the HSL, HSV, or HSI color space in the RGB color space. I believe the description of the transformation as hexagon to circle, as stated by the writer of this article, is in fact a mistake. I made the change to the article a couple months ago, but since then Jacobolus (a Wikipedia moderator) reverted it back to the mistaken version that I previously had corrected! The only reason I asked for the edit to be reverted was to fix what I believe I broke on the page, not for the whole article to be reverted to its previous state! Benhut1 (talk) 01:45, 17 March 2014 (UTC)

You start out with a cube which has been tilted on its end and expanded to fill a hexagonal prism. But then these hexagons must be warped into circles for the numerical model to make sense. The HSL and HSV color spaces are indeed defined in terms of cylinders. The point is, to get from a cube to a cylinder, you need some warping to happen. –jacobolus (t) 08:20, 2 April 2014 (UTC)
I think you might be thinking about the transformation from HSL/HSV -> RGB, whereas the paragraph in question is describing the RGB -> HSL/HSV transformation. –jacobolus (t) 08:21, 2 April 2014 (UTC)

A mistake in formulas for converting back to RGB?

I believe there is a mistake in the formulas for converting back to RGB. In determining the intermediate values, the first piece-wise definition states that these values are all 0 when H is undefined. But, according to the formulas presented in this section, H can never be undefined (if chroma is ever 0, then both Hue and Saturation are set to 0 according to the conversion formulas for RGB to HSL). Would it not be more accurate to say that if chroma is 0, then these component values should all be 0? The corrected formula would then be defined as:

Now that I've studied this article further, it appears that the reference to "if H is undefined" is being referenced from the conversion of RGB to HSL, where, if chroma is 0, then hue is undefined. However, it is noted that for convenience, when hue is undefined, it is generally just set to 0. So for computational purposes, when converting from RGB to HSL, if the calculated value of chroma is zero, you can short circuit much of the computations and merely set hue and saturation to zero. All that's left to calculate then, is the lightness. Conversely, converting such an HSL color back to RGB, chroma would again be calculated as zero, and for efficiency, hue and saturation can simply be assigned 0. And all that's left is determining the amount of lightness to add to each of the R, G, and B components (the quantity in the HSL to RGB conversion formulas). Fourpastmidnight (talk)

Yes, it’s true that you could just define H to be zero in that case, and you’d get a fine result in a practical application, but the point of the formulas here is to be technically precise, not necessarily to be the simplest concrete program implementation. To be precise, H is properly undefined in that case. As for your first concern: note that the two conditions “H is undefined” and “C = 0” are equivalent. –jacobolus (t) 05:38, 12 July 2015 (UTC)

C code

Here is some C code for HLC to RGB and back Though it is unclear to me if the Hexagon approach is more accurate !!??

A little later: I've read the article more thoroughly and the projection of the RGB cube on to the chroma/hue plane is a hexagon so the hexagonal computation is more accurate. — Preceding unsigned comment added by 108.89.37.1 (talk) 00:45, 24 February 2015 (UTC)

#define DEGREES_TO_RADIANS (3.1415926 / 180.0)
#define TWO_OVER_ROOT_THREE (2.0 / sqrt(3.0))
#define ONE_OVER_ROOT_THREE (1.0 / sqrt(3.0))
#define LIMIT_CLAMP(lowerlimit, x, upperlimit) \
		if((x) > (upperlimit)) (x) = (upperlimit); \
		else if((x) < (lowerlimit)) (x) = (lowerlimit)
void RGB_to_HLC(uint8_t r, uint8_t g, uint8_t b, double *hue, double *luma, double *chroma)
{
	double alpha, beta;

	alpha = (2.0 * r - g - b) / 2.0 / 255.0;
	beta  = (g - b) / TWO_OVER_ROOT_THREE / 255.0;
	*luma = (r * 0.21 + g * 0.72 + b * 0.07) / 255.0;	// 0.0 to 1.0 (sRGB Y'709)
	*hue = atan2(beta, alpha) / DEGREES_TO_RADIANS;		// 0° to 360°
	if(*hue < 0) *hue += 360.0;
	*chroma = hypot(alpha, beta);				// 0.0 to 1.0
	LIMIT_CLAMP(0, *hue, 360); LIMIT_CLAMP(0, *luma, 1); LIMIT_CLAMP(0, *chroma, 1);
}
void HLC_to_RGB(double hue, double luma, double chroma, uint8_t *r, uint8_t *g, uint8_t *b)
{
	double alpha, beta, red, green, blue;

	alpha = chroma * cos(hue * DEGREES_TO_RADIANS);
	beta  = chroma * sin(hue * DEGREES_TO_RADIANS);

	blue  = (luma - 0.21 * (alpha + beta * ONE_OVER_ROOT_THREE) - 0.72 * TWO_OVER_ROOT_THREE * beta);
	green = ((blue +         beta * TWO_OVER_ROOT_THREE));
	red   = ((blue + alpha + beta * ONE_OVER_ROOT_THREE));

	LIMIT_CLAMP(0, red, 1); LIMIT_CLAMP(0, green, 1); LIMIT_CLAMP(0, blue, 1);

	red *= 255.0; green *= 255.0; blue *= 255.0;
	*r = (uint8_t)red; *g = (uint8_t)green; *b = (uint8_t)blue;
}

Clive McCarthy — Preceding unsigned comment added by CliveMcCarthy (talkcontribs) 21:21, 23 February 2015 (UTC)

Hi Clive, thanks for the contribution. I’m not sure a wikipedia article is the best place for this code snippet. I believe the combination of the existing pseudocode plus the links out to concrete code implementations in books and other web resources adequately covers the need here. If anyone needs to implement HSL/HSV/etc. in C or another language, the citations here have them well covered. Additionally, note that this code doesn’t quite line up with the symbols used in this article, which would probably be confusing if it were included. –jacobolus (t) 05:38, 12 July 2015 (UTC)

What is mod2 ?


Is this the same as Mod(H', 2) (reminder from division H' by 2 ?) ?
And | means absolute value ?
Conversion HSV to RGB using method from this article works well in VBA, but this part with mod2 changes result only a little if modified and it is difficult to say wahat this is - Mod(H', 2), Mod(H', -1) or something else. In one case Mod(H', -1) gave incorrect result, Mod(H', 2) always gaves correct color values. By the way - colors (R, G, B) should by multiplied by 255 if someone wants them in most popular form. Thanks
Darekk2 (talk) 19:46, 7 June 2015 (UTC)

Hi Darekk2, the mod operator here is described at Modulo operation, which I believe is already linked from the article somewhere. Also, yes, the vertical bars indicate absolute value. And you’re right, everything here is in terms of RGB colors expressed on the interval [0, 1], but you might want to use integers in [0, 255] instead in some contexts. –jacobolus (t) 05:38, 12 July 2015 (UTC)
Actually, let me restate as code: X = C * (1 - abs(mod(Hprime, 2) - 1)). –jacobolus (t) 05:43, 12 July 2015 (UTC)
This bit of formula could also easily be written as a conditional statement, which might be a better choice in some programming contexts. Using mod and absolute value just makes everything a bit more compact. –jacobolus (t) 05:45, 12 July 2015 (UTC)

More mistakes in the HSV to RGB conversion

I attempted to write the code.

def hsv2rgb(hsv):

   # https://en.wikipedia.org/wiki/HSL_and_HSV
   
   # -------------------------------------------
   # pull them aside for sanity's sake
   # -------------------------------------------
   hue        = float(hsv[0])
   saturation = (float(hsv[1]) / 100.0)
   value      = (float(hsv[2]) / 100.0)
   
   # -------------------------------------------
   # get chroma
   # -------------------------------------------
   chroma = value * saturation
   
   # -------------------------------------------
   # Revert hue to hue prime
   # -------------------------------------------
   hue = hue / 60.0
   
   # -------------------------------------------
   # find second highest value
   # -------------------------------------------
   midling = chroma * (1 - abs((hue % 2) - 1))
   
   # -------------------------------------------
   # find red, green, and blue primes
   # -------------------------------------------
   red   = 0.0
   green = 0.0
   blue  = 0.0
   
   if (saturation == 0.0):
       red   = 0.0
       green = 0.0
       blue  = 0.0
   elif (hue < 1.0):
       red   = chroma
       green = midling
       blue  = 0.0
   elif (hue < 2.0):
       red   = midling
       green = chroma
       blue  = 0.0
   elif (hue < 3.0):
       red   = 0.0
       blue  = midling
       green = chroma
   elif (hue < 4.0):
       red   = 0.0
       green = midling
       blue  = chroma
   elif (hue < 5.0):
       red   = midling
       green = 0.0
       blue  = chroma
   elif (hue < 6.0):
       red   = chroma
       green = 0.0
       blue  = midling
       
   # -------------------------------------------
   # add min value to each
   # -------------------------------------------
   min_rgb = value - chroma
   
   red   = red + min_rgb
   green = green + min_rgb
   blue  = blue + min_rgb
   
   # -------------------------------------------
   # round the numbers to useful values for gimp
   # -------------------------------------------
   red   = round(red   * 255)
   green = round(green * 255)
   blue  = round(blue  * 255)
   
   # -------------------------------------------
   # That should be it!
   # -------------------------------------------
   return(red, green, blue)

Feel free to test this. The input is an HSV tuple, where Hue is from 0 to 360, Saturation is from 0 to 100, and Value is from 0 to 100.

The notable difference comes here:

   elif (hue < 3.0):
       red   = 0.0
       blue  = midling
       green = chroma

Which suggests that the piecewise definition should have one piece changed, from

To

I have omitted the irrelevant pieces for brevity as this is already running long.

Please review and advise. Greysondn (talk) 23:59, 10 November 2015 (UTC)

Rant

I don't think the style of the Disadvantages and Other cylindrical-coordinate color models is warranted on this site. Examples: "Such perversities led Cynthia Brewer, expert in color scheme choices for maps and information displays, to tell the American Statistical Association: ..." "The creators of HSL and HSV were far from the first to imagine colors fitting into conic or spherical shapes..."

I strongly recommend moving these sections towards a more neutral point of view. --mafutrct (talk) 11:28, 29 September 2015 (UTC)

@Mafutrct: I think a lot of the content would be more appropriate for a Cylindrical-coordinate color model article than this one. SharkD  Talk  08:37, 13 December 2015 (UTC)

HSL vs HSV usefulness

There is an interesting discussion here about how and why HSL and HSV are used differently. http://stackoverflow.com/a/17350333/330663 Basically, HSV models how objects are lit (and thus is useful to photographers), whereas HSL is useful to painters who want to pick or "input" colors from a palette. Is this discussed in a reliable source somewhere? SharkD  Talk  06:54, 18 November 2016 (UTC)

The article says several notable photo editing programs use HSL, which would argue against that. Samsara 08:59, 18 November 2016 (UTC)
It depends on the program. Photoshop's Hue/Saturation tool is in LAB space, so is not the same as HSL which is in RGB or sRGB space. Not as many programs use HSL in their color pickers. SharkD  Talk  15:40, 20 November 2016 (UTC)

HCL

Given the breadth of the scope of this article, would it be okay to merge HCL color space here? SharkD  Talk  03:01, 15 November 2016 (UTC)

I think this article is doing rather a lot of lifting already. Merging more into it would not be a good idea imo. Samsara 09:01, 18 November 2016 (UTC)
Well, nearly 50% of the article deals with perceptually-uniform color spaces, and HCL is barely mentioned despite being an obvious choice for discussion. SharkD  Talk  15:42, 20 November 2016 (UTC)

American English

I added the American English templates to the article and talk pages. There was a mix used with the vast majority being American. I changed "colour" to "color" except in book and journal titles. I suspect they need to be checked since the one article I checked that had "generalised" in the title was actually published as "Generalized".User-duck (talk) 20:44, 3 September 2017 (UTC)

Luma vs. Lightness

Both on the internet and in all software I've ever used, HSL has, in short, stood for 'Hue Sat Lum', not 'Hue Sat Lig', so why is it that in this article HSL is said to be an acronym for 'Hue, Saturation, Lightness' rather than 'Hue, Saturation, Luma' (or luminosity I'm not sure on which one it is)? BenYaMan (talk) 15:40, 22 April 2018 (UTC)

Hmm ... some websites think the L stands for lightness, some luminance, and some luminosity. Do we go with the most reliable source? How do we decide which this is? Dbfirs 16:39, 22 April 2018 (UTC)
The drawing from the original Tektronics terminal use shows Lightness. I think trying to say Luminance or Luma is fraught with problems, since those terms have more rigorous definitions, while HSL is pretty loose, typically depending on what RGB space you're converting to or from. But yes let's see if we can decide what better sources say. Dicklyon (talk) 19:02, 22 April 2018 (UTC)

Luminance

I thought "luminance" should only be used for objects that emit light, not for objects which reflect light? SharkD  Talk  17:46, 6 September 2017 (UTC)

No, that's pretty broadly wrong, according to sources. Dicklyon (talk) 19:03, 22 April 2018 (UTC)

Problematic use of mod

In many of the descriptions of conversions, the modulus operator is applied to real values. This is confusing as the modulo operator is typically considered to only apply to integers, but the algorithms are only correct if mod is taken to produce a real-valued remainder. Even a programmer reading some of the algorithms might assume the integer interpretation of mod, especially since hue is often converted to a number between 0 and 6. Just before adding this comment, I had to delete an attempt to convey a "fixed" HSV->RGB conversion in incredibly broken English which also contained many factually incorrect statements. Presumably the author had attempted to implement the algorithm from Wikipedia before finding that it didn't produce the expected result. AnalyticalEngine (talk) 03:51, 27 August 2018 (UTC)

Splitting content

I have split off the "Cylindrical-coordinate color models" section into Color_model#Cylindrical-coordinate_color_models. I think the "Disadvantages" section could also be split off into an article that deals with "perceptual uniformity"/"perceptual relevance" more generally. ➧datumizer  ☎  00:50, 11 September 2018 (UTC)