Consider, I have a disk colored in "LAB" color space. When I convert the graphics into image object it is by default getting converted into "RGB" color space.
ImageColorSpace@Image[Graphics[{LABColor[0.4, 0.6, 0.8], Disk[]}]]
"RGB"
If I now convert it back to "LAB" color space,
ColorConvert[
Image[Graphics[{LABColor[0.4, 0.6, 0.8], Disk[]}]], "LAB"]
The color value that I get is
{0.40047, 0.603491, 0.548764}
(* Sorry, this was a mistake on my part. Duely corrected after following the answer by Theelepel *)
How can I get the original color value in the "LAB" color space?
Updated question: If the original color value is not known and I am given only with the final Graphics object showing RGB color value, How can I retrieve the original LAB color value?
Updation 2: Following the answer of corey979
to this question, I can see
Table[data =
ImageData[
ColorConvert[Graphics[{LABColor[0.4, 0.6, b], Disk[]}],
"LAB"]][[100, 100]];
N@Rationalize[#, 1/255] &@data, {b, 0, 1, 0.1}]
{{0.4, 0.6, 0.}, {0.4, 0.6, 0.105263}, {0.4, 0.6, 0.2}, {0.4, 0.6, 0.3}, {0.4, 0.6, 0.407407}, {0.4, 0.6, 0.5}, {0.4, 0.6, 0.545455}, {0.4, 0.6, 0.545455}, {0.4, 0.6, 0.545455}, {0.4, 0.6, 0.545455}, {0.4, 0.6, 0.545455}}
Clearly, up to 0.5
for the value of b
this works fine except for 0.1
and 0.4
. However, from 0.6
onwards the b
value remains fixed at 0.545455
.
(1) Is it not possible to resolve this issue?
(2) Can there be any way in the Graphics
option to prevent it from automatic conversion to RGB
?