There's a number of color spaces that will give you something like that. Try
the color space FAQ :
Usually there's just a few equations that relate the space to RGB so writing
the code is pretty easy.
> Hi, I've searched a long time on the net trying to find some C or Java
> code to do conversions from RGB to L*a*b* and back, but haven't found what
> I'm looking for. Actually, I'm not sure it's technically L*a*b* that I
> need, but I am basically looking to convert an 8-bit-per-channel RGB pixel
> into an 8-bit-per-channel format where ch.A would be the Luminance
> [0..255], ch.B and ch.C would describe the chrominance component in the
> range [0.255] each.
> So, I guess first, can anyone tell me exactly what that format would be
> called? I'm pretty sure it's similar to the L*a*b* concept, but I don't
> want to deal with white points, CIE XYZ etc., just a simple conversion
> that will allow me to make those RGB values more compressable.
> Then, does anyone have any hard code for me do do this?
> Thanks very much if you can help.
> - Ben