Skip to content

Origin of the HCL colorspace used in trollimage

Martin Raspaud edited this page Feb 16, 2023 · 1 revision

As of v1.20.1 and since the beginning of the trollimage history, there has been a colorspace called hcl used for color interpolation.

The implementation is in https://github.com/pytroll/trollimage/blob/02b8330165815649e3570b03d5e8b07d2dbd7fca/trollimage/colorspaces.py#L66-L85 and does not match anything existing today (february 2023). As part of a speedup and refactoring work conducted here: https://github.com/pytroll/trollimage/pull/122, a need arose to trace back the origin of this code.

So, memory is hazy, but there was a color picker on this blog post a log time ago: http://www.vis4.net/blog/2011/12/avoid-equidistant-hsv-colors/, and I believe this is where the code was found at the time (2012).

The author of this blog post turns out to be the author of chroma.js, and looking at the chroma.js history, we find this: https://github.com/gka/chroma.js/blob/97cc4223f4278aabc3fe99275305a759b1cbdaae/src/chroma.coffee#L411-L433 which is exactly what we have now in trollimage.

Looking even further, there a link in the blog post that is now dead, but the internet archive has it: https://web.archive.org/web/20110926155739/http://davidad.net/colorviz/, that explains the scaling of the L parameter in hcl <-> lab conversion

Now, later in the story of chroma.js, hcl was replaced by lch (as in CIELch_ab). (this commit https://github.com/gka/chroma.js/commit/42dd32a34f5441569a8e42c77428c03de22607f5)

Clone this wiki locally