Skip to content
Advertisement

Tag: rgb

HTML canvas image from rgb values

I have three 12×12 arrays, each with R, G and B values. How would I go about outputting the image (12×12) using HTML Canvas? I’ve come across Canvas demos that show drawing lines and whatnot, but nothing like providing some RGB arrays to produce something. Any guidance is greatly appreciated. Answer You can use the fillRect method, described here :

RGB to XYZ and LAB colours conversion

I’m having problems converting colours from RGB to LAB space It should be straight forward using the formulas from here, only I’m getting back the wrong values RGB = 56,79,132 X = 8.592 Y = 8.099 Z = 22.940 and CIE-L*ab as L* 34.188 a* 8.072 b* -32.478 This is my code; but I can’t see where I’m going wrong.

Why doesn’t this Javascript RGB to HSL code work?

I found this RGB to HSL script over at http://www.mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript. I can’t find any other small decent ones. The issue is that this code doesn’t even really work. Would anybody know why? (I don’t know a bit of color math, but maybe it’s returning the complementary?) Edit: when I run rgbToHsl(126,210,22) it’s giving me [ .24, .81, .45 ], which

Advertisement