Page 1 of 1
Making a new 16-bit Lab color
Posted: 2015-05-12T11:18:51-07:00
by tom_dl
Version: ImageMagick 6.9.0-10 Q16 x64
Hi, I'm having trouble setting the canvas a very specific color. The line I want to use would look like this:
Code: Select all
convert -depth 16 -size 2700x5120 -colorspace lab xc:"lab(0,-223,204)" output.tif
But that produces the following 16-bit Lab values:
If I want to input 8-bit values, I can use this line:
Code: Select all
convert -depth 16 -size 2700x5120 -colorspace lab xc:"lab(0,-2,2)" output.tif
and I get the following 8-bit Lab values:
so the line has worked. When I set the 16-bit values (as in the first example), the line doesn't work. If I didn't need the specificity of 16-bit, I would settle with the above. However, I do, so any suggestions are very welcome!
Re: Making a new 16-bit Lab color
Posted: 2015-05-12T17:12:16-07:00
by fmw42
Lab colors other than in HDRI mode are not negative. They have been biased for non-hdri mode compiles. -depth 16 should come after creating the image and before the output, though it may not matter in IM 6. See
http://www.imagemagick.org/script/color.php and search for lab. It says:
Specify the Lab colors like this:
cielab(62.253188, 23.950124, 48.410653)
which I believe are in the range 0 to 255. For HDRI, I am not sure about the range, but I think it conforms to the standard lab values with negate A and B channels. See also
http://www.brucelindbloom.com/index.htm ... lator.html
Re: Making a new 16-bit Lab color
Posted: 2015-05-13T01:35:51-07:00
by tom_dl
That's very helpful, thanks! I'll use that format instead. Just out of curiosity, how come my second line (0,-2,2) works with negative values, when I'm not in HDRI mode?
Re: Making a new 16-bit Lab color
Posted: 2015-05-13T03:32:59-07:00
by tom_dl
After trying out your advice, I can conclude two things:
* Using decimal precision does indeed work, so I can reach my desired values by using (0,-0.87109,0.79067)
* As alluded to above, negative values do seem to work (for a & b channels, at least) in non-HDRI mode
If you use -colorspace lab and output to *.txt, you will see IM stores lab values as such:
Code: Select all
# ImageMagick pixel enumeration: 1,1,65535,cielab
0,0: (73.6721%,-0.883497%,0.720226%) #BC99000001D8 cielab(73.6721%,-0.883497%,0.720226%)
Got there eventually! Thanks
Re: Making a new 16-bit Lab color
Posted: 2015-05-13T09:24:45-07:00
by fmw42
This is news to me. Perhaps IM now takes care of the bias automatically when using cielab color specification.
Are you sure you are not in HDRI? Does it list HDRI when you do convert -version.
Re: Making a new 16-bit Lab color
Posted: 2015-05-14T04:44:56-07:00
by tom_dl
I'm not in HDRI. When I do convert -version, I get this:
Code: Select all
$ convert -version
Version: ImageMagick 6.9.0-10 Q16 x64 2015-02-28 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: DPC Modules OpenMP
Delegates (built-in): bzlib cairo freetype jbig jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib