[reportlab-team] [reportlab-users] reportlab and CMYK images, take 2

Andy Robinson reportlab-users@reportlab.com
Fri, 3 Oct 2003 09:56:59 +0100


> Ok,
> 
> I'll start a new thread here. Andy, I just saw a mail to the list from 
> you which forwarded my answer to your mail, but without new content. 
> Don't know if this was deliberate.

We still haven't got our mail handling sorted, sorry
about this.  There are just too many filters and
rules and we ran out of time to investigate it due
to customer pressures.  Will resume head-scratching at the 
weekend....

> Now to the technical aspects, from staring at the pdf specification and 
> pdfimages.py, it seems that adding a CMYK jpg file is straightforward, 
> and nearly done. One thing I stumbled across was an inconsistent use of 
> self.colorSpace ( in __init__() and in format() ) vs. colorSpace in 
> pg_imagedata(). Seems like a bug, though I don't know if it has 
> detrimental effects.
> 
> Is it desirable and would it make sense to beef up reportlab's image 
> capabilities? Are there any thoughts into what direction one should go 
> with this?

None of us really know anything about color spaces and images
but I would welcome a contribution here. When I first tried
to get images working again, I just figured out how to encode
the RGB pixels in a legal manner in the PDF spec, and never
bothered with other formats.

It would be great to support CMYK in images and possibly useful for 
us too.  Please feel free to send in patches.

I think there must be some degree of normlisation or inspection
of images.  A GIF uses a palette and it would be complex to
encode the same palette in PDF, so a one-liner to nromalize them
as RGB seemed sensible.  So at the API level I suggest you add
some keyword parameters to indicate desired or given color space
to drawImage/drawInlineImage.  i.e. if you tell it you have
a CMYK image and you want a CMYK image, there is no conversion;
if you tell it you want CMYK and you give it something else,
it either converts or complains noisily (I don't mind which).
We should also check in a sample CMYK image or two into
the distribution.

Thanks,

Andy Robinson