简体   繁体   English

将RGB图像转换为hexachrome / CIELAB / CIE XYZ

[英]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). 我想使用在Linux或Windows下都可以运行的python 2.7脚本,将图像从RGB转换为Hexachrome(或CIELAB或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. 您可以使用ImageMagick(在Windows,Linux和OS X的命令行中作为二进制文件运行)或Python,Perl,PHP,.NET绑定来实现。 Check it out at ImageMagick . ImageMagick上检查一下。

In your case, CIELab is identical to ImageMagick's Lab colorspace, so you can do 在您的情况下,CIELab与ImageMagick的Lab色彩空间相同,因此您可以

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: 如果您输入的图像只是二进制数据,您还可以在ImageMagick中读取它,但是您需要在读入图像之前指定大小和字节序,类似以下几行:

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. 您也可以转换为其他文件格式-只要它们支持Lab色彩空间即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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