Conversion From Cmyk To Rgb With Pillow Is Different From That Of Photoshop
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') The code works, but if I
Solution 1:
SOLVED
The problem is that Pillow does not know the input ICC profile, while photoshop had one set as default.
Photoshop use for
CMYK: U.S. Web Coated (SWOP) v2
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)
On Windows the profiles can be found (if installed) in these folders:
C:\Windows\System32\spool\drivers\color\USWebCoatedSWOP.iccC:\Program Files (x86)\Common Files\Adobe\Color\Profiles\Recommended\USWebCoatedSWOP.iccC:\Program Files (x86)\Adobe\Acrobat DC\Resource\Color\Profiles\Recommended\USWebCoatedSWOP.iccC:\Windows\System32\spool\drivers\color\sRGB Color Space Profile.icmC:\Program Files (x86)\Common Files\Adobe\Color\Profiles\Recommended\sRGB Color Space Profile.icmC:\Program Files (x86)\Adobe\Acrobat DC\Resource\Color\Profiles\Recommended\sRGB Color Space Profile.icm
Post a Comment for "Conversion From Cmyk To Rgb With Pillow Is Different From That Of Photoshop"