[reportlab-users] Non-JPEG CMYK images
Robin Becker
robin at reportlab.com
Tue Feb 26 06:34:17 EST 2008
Stevens, Ian wrote:
.........
>
> 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':
>
> 98c98,107
> < myimage = image.convert('RGB')
> ---
>> # Use the colorspace in the image
>> mode = image.mode
>> if mode == 'CMYK':
>> myimage = image
>> colorSpace = 'DeviceCMYK'
>> else:
>> myimage = image.convert('RGB')
>> colorSpace = 'RGB'
>>
> 104c113
> < imagedata=['BI /W %d /H %d /BPC 8 /CS /RGB /F [/A85 /Fl] ID' %
> (imgwidth, imgheight)]
> ---
>> imagedata=['BI /W %d /H %d /BPC 8 /CS /%s /F [/A85 /Fl] ID' %
> (imgwidth, imgheight, colorSpace)]
>
.......
it's a bit hard to figure out what you're patching without either of the
filename and or svn version :)
I looked in the latest trunk code and the ImageReader object has this
if sys.platform[0:4] == 'java':
........
else:
im = self._image
mode = self.mode = im.mode
if mode=='RGBA':
self._dataA = ImageReader(im.split()[3])
im = im.convert('RGB')
self.mode = 'RGB'
elif mode not in ('L','RGB','CMYK'):
im = im.convert('RGB')
self.mode = 'RGB'
self._data = im.tostring()
so in the PIL branch we're trying to preserve the existing mode. Are you saying
that even so the PIL images get converted somewhere else to RGB? I suspect that
would not be intended, but this image stuff is fairly horrendous.
--
Robin Becker
More information about the reportlab-users
mailing list