[Image-SIG] Converting from "CMYK" to "RGB"
Hajime Nakagami
nakagami at gmail.com
Fri Jul 5 15:56:11 CEST 2013
Hi Matti
> image.convert('RGB')
this code return converted image but abandoned
Please rewrite as below
> image = image.convert('RGB')
2013/7/1 Matti Viljamaa <mviljamaa at kapsi.fi>
> I'm trying to handle CMYK images by converting them to RGB. I'm using the
> following code snippet:
>
> import sys
> from PIL import Image
>
> def loadImage(self, imageFileName):
> imageFile = open(imageFileName)
> image = Image.open(imageFile)
>
> if(image.mode == 'CMYK' ):
> image.convert('RGB')
>
> However the image is not converted to RGB, although its mode is recognized
> as CMYK.
>
> Later when loading this image into a QImage (of the Qt GUI library), the
> compiler produces an error indicating that the mode is still CMYK:
> ValueError: unsupported image mode 'CMYK'
>
> So how can CMYK images be handled?
>
> My PIL is of version 1.1.6.
>
> _______________________________________________
> Image-SIG maillist - Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20130705/43201123/attachment.html>
More information about the Image-SIG
mailing list