非常谢谢你。
adobeRGB 转换为sRGB ,是颜色空间之间的关系,跟16bit和8bit,跟565和555不一样的。
adobeRGB相比sRGB还记录有好多信息,adobeRGB是设备产生的直接像素信息(设备单元记录下来的传感器数据),属于元数据,没有修改过的。
Adobe RGB还包含了sRGB所没有完全覆盖的CMYK色彩空间。这使得Adobe RG8色彩空间在印刷等领域具有更明显的优势。
这是找到的一段python中PIL的代码,可是没搞懂,image.convert中使用的那个矩阵是怎么起作用的,并且我作为矩阵相乘来测试,结果还是很暗。
adobe_to_xyz和xyz_to_srgb
Thanks for the spec link martineau, I've put some working PIL code together with functions that detect the presence of a Adobe RGB ICC profile within an Image, and convert the colorspace to sRGB.
adobe_to_xyz = (
0.57667, 0.18556, 0.18823, 0,
0.29734, 0.62736, 0.07529, 0,
0.02703, 0.07069, 0.99134, 0,
) # http://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf
xyz_to_srgb = (
3.2406, -1.5372, -0.4986, 0,
-0.9689, 1.8758, 0.0415, 0,
0.0557, -0.2040, 1.0570, 0,
) # http://en.wikipedia.org/wiki/SRGB
def adobe_to_srgb(image):
return image.convert('RGB', adobe_to_xyz).convert('RGB', xyz_to_srgb)
def is_adobe_rgb(image):
return 'Adobe RGB' in image.info.get('icc_profile', '')
# alternative solution if happy to retain profile dependency:
# http://stackoverflow.com/a/14537273/284164
# icc_profile = image.info.get("icc_profile")
# image.save(destination, "JPEG", icc_profile=icc_profile)
(I used these to create a Django easy-thumbnails processor function):
def preserve_adobe_rgb(image, **kwargs):
if is_adobe_rgb(image):
return adobe_to_srgb(image)
return image
[/quote]
学到了。
非常谢谢你。
adobeRGB 转换为sRGB ,是颜色空间之间的关系,跟16bit和8bit,跟565和555不一样的。
adobeRGB相比sRGB还记录有好多信息,adobeRGB是设备产生的直接像素信息(设备单元记录下来的传感器数据),属于元数据,没有修改过的。
Adobe RGB还包含了sRGB所没有完全覆盖的CMYK色彩空间。这使得Adobe RG8色彩空间在印刷等领域具有更明显的优势。
这是找到的一段python中PIL的代码,可是没搞懂,image.convert中使用的那个矩阵是怎么起作用的,并且我作为矩阵相乘来测试,结果还是很暗。
adobe_to_xyz和xyz_to_srgb
Thanks for the spec link martineau, I've put some working PIL code together with functions that detect the presence of a Adobe RGB ICC profile within an Image, and convert the colorspace to sRGB.
adobe_to_xyz = (
0.57667, 0.18556, 0.18823, 0,
0.29734, 0.62736, 0.07529, 0,
0.02703, 0.07069, 0.99134, 0,
) # http://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf
xyz_to_srgb = (
3.2406, -1.5372, -0.4986, 0,
-0.9689, 1.8758, 0.0415, 0,
0.0557, -0.2040, 1.0570, 0,
) # http://en.wikipedia.org/wiki/SRGB
def adobe_to_srgb(image):
return image.convert('RGB', adobe_to_xyz).convert('RGB', xyz_to_srgb)
def is_adobe_rgb(image):
return 'Adobe RGB' in image.info.get('icc_profile', '')
# alternative solution if happy to retain profile dependency:
# http://stackoverflow.com/a/14537273/284164
# icc_profile = image.info.get("icc_profile")
# image.save(destination, "JPEG", icc_profile=icc_profile)
(I used these to create a Django easy-thumbnails processor function):
def preserve_adobe_rgb(image, **kwargs):
if is_adobe_rgb(image):
return adobe_to_srgb(image)
return image