0

I'm trying to import a CMYK image into python to check the total ink coverage. I saved the image with adobe illustrator as jpg, and it looks OK in the windows viewer. When open the image in python some of the colors are distorted. In the example image, the brown is completely black. I've tried starting from a TIF file but same problem occured.

from PIL import Image
import matplotlib.pyplot as plt

imgName = 'filename.jpg'     # Filename
img = Image.open(imgName)

plt.figure()           
plt.imshow(img)

As seen with python

Original opened image

user1908460
  • 193
  • 1
  • 1
  • 9
  • Read an excellent explanation on CMYK->RGB from @patapouf_ai in >>> https://stackoverflow.com/a/30078860/3666197 and rather keep all the original CMYK-file data detail ( ... avoid any external xlations ) – user3666197 Mar 31 '18 at 19:26
  • The values when I read the file are in range of 0 to 255, but when I use the plot function the colors are off. Are you saying I need to do a color conversion before plotting? Is pyplot using a different color type for the plot? – user1908460 Mar 31 '18 at 19:33
  • For instance, the brown color has the value of -> 48/65/84/49 (0to 100) in illustrator -> 122/168/216/125 in the python array (same as above but rescaled to 0 - 255) -> 8/0/0/255 when I hover over the image this value shows up (completely different from the above two) – user1908460 Mar 31 '18 at 19:36

0 Answers0