[reportlab-users] Non-JPEG CMYK images

Robin Becker robin at reportlab.com
Tue Feb 26 05:20:08 EST 2008

Stevens, Ian wrote:

> In addition to complaining about RGB text, our printer is complaining

> about RGB images. The thing is, these are TIFF images which are

> actually CMYK. Reportlab is converting them to RGB in

> reportlab.pdfgen.pdfimages.PDFImage.PIL_imagedata(). I couldn't find a

> way to stop this, but I came across an old discussion at

> http://two.pairlist.net/pipermail/reportlab-users/2003-October/002137.ht

> ml. The CMYK support for JPEG images has long since been completed, but

> is obviously incomplete for PIL images, which are just converted to RGB.


> I probably don't have a full grasp of the implications of CMYK support

> for PIL images, but would it make sense to treat them as JPEG images are

> currently treated? (ie. use the colorspace within the image itself) I

> made a naive change to the code and it seems to have fixed the PDF

> colorspace for our CMYK images. (ie. they are now as CMYK in the PDF,

> not RGB)


> What follows is the patch I'm using. I don't know exactly what PIL

> image modes of '1', 'L', 'RGBX' or 'RGBA' mean in this context, so those

> modes get converted to 'RGB':

we have special handling for JPEG(which is PDF native) and for some RGBA images.
Unfortunately there are an awful lot of image types and we just smash them all
together into one standard. How does PIL present these images ie is the mode
actually CMYK? We have used 4 colour jpegs, but it seems we sometimes need to
transform the colours and other times not. So is the TIFF in additive or
subtractive mode when it's a CMYK etc etc.
Robin Becker

More information about the reportlab-users mailing list