使用枕头从CMYK转换为RGB与Photoshop的转换不同 [英] Conversion from CMYK to RGB with Pillow is different from that of Photoshop

查看:264
本文介绍了使用枕头从CMYK转换为RGB与Photoshop的转换不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在python中将图像从CMYK转换为RGB.我以这种方式使用枕头:

I need to convert an image from CMYK to RGB in python. I used Pillow in this way:

img = Image.open('in.jpg')
img = img.convert('RGB')
img.save('out.jpg')

代码可以正常工作,但是如果我用Photoshop转换相同的图像,则会得到不同的结果,如下所示:-

The code works, but if I convert the same image with Photoshop I have a different result as shown below:-

在photoshop中完成的唯一操作是将方法从CMYK更改为RGB. 为什么两个RGB图像之间存在这种差异?可能是颜色配置文件问题?

The only operation done in photoshop is to change method from CMYK to RGB. Why there is this difference between the two RGB images? It can be a color profile problem?

推荐答案

已解决

问题是Pillow不知道输入的ICC配置文件,而photoshop具有默认设置.

The problem is that Pillow does not know the input ICC profile, while photoshop had one set as default.

Photoshop用于

Photoshop use for

CMYK :美国Web涂层(SWOP)v2

CMYK: U.S. Web Coated (SWOP) v2

RGB :sRGB IEC61966-2.1

RGB: sRGB IEC61966-2.1

所以我已经通过这种方式解决了:

So I've solved in this way:

img = Image.open('in.jpg')
img = ImageCms.profileToProfile(img, 'USWebCoatedSWOP.icc', 'sRGB Color Space Profile.icm', renderingIntent=0, outputMode='RGB')
img.save('out.jpg', quality=100)


在Windows上,可以在以下文件夹中找到配置文件(如果已安装):


On Windows the profiles can be found (if installed) in these folders:

C:\Windows\System32\spool\drivers\color\USWebCoatedSWOP.icc
C:\Program Files (x86)\Common Files\Adobe\Color\Profiles\Recommended\USWebCoatedSWOP.icc
C:\Program Files (x86)\Adobe\Acrobat DC\Resource\Color\Profiles\Recommended\USWebCoatedSWOP.icc

C:\Windows\System32\spool\drivers\color\sRGB Color Space Profile.icm
C:\Program Files (x86)\Common Files\Adobe\Color\Profiles\Recommended\sRGB Color Space Profile.icm
C:\Program Files (x86)\Adobe\Acrobat DC\Resource\Color\Profiles\Recommended\sRGB Color Space Profile.icm

这篇关于使用枕头从CMYK转换为RGB与Photoshop的转换不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆