Re: Converting from "CMYK" to "RGB"
Kevin Cazabon <[email protected]> Fri, 5 Jul 2013 10:04:29 -0400
| Newsgroups | gmane.comp.python.image |
|---|---|
| Message-ID | <[email protected]> |
Convert does not modify the image in place : it returns a new converted image.
Use newim = origim.convert("RGB")
Kevin
On Jun 30, 2013, at 18:29, Matti Viljamaa <[email protected]> wrote:
> 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 - [email protected]
> http://mail.python.org/mailman/listinfo/image-sig
_______________________________________________
Image-SIG maillist - [email protected]
http://mail.python.org/mailman/listinfo/image-sig