11 ms·
Colour Science for Python
- leni536 12y agoNice. Everybody who programs something that involves calculations with colours in any way should learn some colour science. It's not hard in any way but lot's of stuff are missed in most applications. One of the most missed feature is the lack of using a linear colourspace when it is necessary, like scaling (especially scaling down) images [1] or calculating physical models (like the Phong model [2]) that implicitly imply a linear colourspace. Iceweasel 35 still doesn't use a linear colourspace for scaling, there is a simple example image showing that [3] (try to zoom out). Last time I checked their SVG engine's Phong model implementation (yes, SVG supports bump maps with custom lighting settings) was broken too. It was a long time ago, I submitted a bug report for it but somehow it was marked as a duplicate for a "fixed" bug so I do not think that it got fixed since then. [1] http://www.4p8.com/eric.brasseur/gamma.html http://www.4p8.com/eric.brasseur/gamma.html [2] http://en.m.wikipedia.org/wiki/Phong_reflection_model http://en.m.wikipedia.org/wiki/Phong_reflection_model [3] http://www.4p8.com/eric.brasseur/gamma-1.0-or-2.2.png http://www.4p8.com/eric.brasseur/gamma-1.0-or-2.2.png edit: formatting edit: Found the reference renderings of the feDiffuseLighting filter [4]. In my Iceweasel 35 the SVG images are much darker than the prerendered png. [4] http://www.w3.org/Graphics/SVG/Test/20110816/harness/htmlObjectApproved/filters-diffuse-01-f.html http://www.w3.org/Graphics/SVG/Test/20110816/harness/htmlObj...
- rprospero 12y agoI've used the ColorPy (http://markkness.net/colorpy/ColorPy.html http://markkness.net/colorpy/ColorPy.html) a bit before and had some good luck with it. Anyone know who colorpipe compares?
- kelsolaar 12y agoI haven't checked precisely but we do support all the relevant computations colorpy does, it is an excellent project by the way.
- vanattab 12y agoDo you guys support the LMS colorspace i.e. where L,M,S is the stimulation of the long, med, short cones in the human eye.
- smu3l 12y agoJulia's Colors.jl[1] does. [1] https://github.com/JuliaLang/Color.jl#lms https://github.com/JuliaLang/Color.jl#lms
- kelsolaar 12y agoWe do have support for quite a few chromatic adaptation transforms to cones space (https://github.com/colour-science/colour/blob/develop/colour/adaptation/dataset/cat.py https://github.com/colour-science/colour/blob/develop/colour...) some cones space transformation are directly tied to the various chromatic adaptation models (https://github.com/colour-science/colour/tree/develop/colour/adaptation https://github.com/colour-science/colour/tree/develop/colour...) or colour appearance models (https://github.com/colour-science/colour/tree/develop/colour/appearance https://github.com/colour-science/colour/tree/develop/colour...) we have implemented. We also have the Stockman & Sharpe Cone Fundamentals for 2 and 10 degree observers (https://github.com/colour-science/colour/blob/develop/colour/colorimetry/dataset/cmfs.py#L90 https://github.com/colour-science/colour/blob/develop/colour...) and the code to convert those cone fundamentals cmfs to the corresponding XYZ cmfs (https://github.com/colour-science/colour/blob/develop/colour/colorimetry/transformations.py#L229 https://github.com/colour-science/colour/blob/develop/colour...) although it is more educational than anything else because often, the resulting cmfs are manually adjusted (I would have to check if it is the case with the XYZ cmfs resulting from the LMS cmfs).
- canavandl 12y agoAlso, check out http://colour-science.org/ http://colour-science.org/ It has python implementations of a ton of colorspaces and transforms. Also some cool support for spectral data.