3

Using pythons PIL from Pillow 5.2 to convert images to CMYK I want to do some rule-of-thumb estimationswith the results. The conversion using Image.convert("CMYK") seems to never use the K component. Since I need it for printing purposes. I wish to same save color ink and use black ink whenever it is possible.

I could do these convertion manually using this code which produces the results I expect. But I do not only have RGB sources and I want to prevent me from converting my sources to RGB by PIL and then use this code to convert it to CMYK. Is there a better PIL-native way?

example:

img = Image.open("5procent_gray.png")
im = img.load()
print(im[0,0])
img2 = img.convert("CMYK")
im2 = img2.load()
print(im2[0,0])

returns

(50, 50, 50)
(205, 205, 205, 0)

instead of (0,0,0,205) which I would expect.

Sajote
  • 31
  • 3
  • Not 100% sure, but I think it has something to do with PIL being aware of color profile. See https://mail.python.org/pipermail/image-sig/2009-July/005793.html and this SO answer https://stackoverflow.com/questions/38855022/conversion-from-cmyk-to-rgb-with-pillow-is-different-from-that-of-photoshop – dwagnerkc Oct 17 '18 at 15:27

0 Answers0