简体   繁体   中英

convert RGB image to hexachrome/CIELAB/CIE XYZ

I would like to use a python 2.7 script, that should work under Linux or Windows, to convert image from RGB to Hexachrome (or CIELAB or CIE XYZ). I wondered if there are any library that can do this?

You can do that with ImageMagick which runs as binaries at the command line in Windows, Linux, and OS X, or with Python, Perl, PHP, .NET bindings. Check it out at ImageMagick .

In your case, CIELab is identical to ImageMagick's Lab colorspace, so you can do

convert input.jpg -colorspace lab output.tif

for example. If your input image is just binary data, your can also read that in ImageMagick, but you will need to specify the size and endianness in advance of reading it in, something along these lines:

convert -size 512x512 -depth 16 -endian MSB image.rgb -colorspace lab output.tif

You can convert to other file formats too - so long as they support Lab colourspace.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM