<div dir="ltr">Hi Matti<div><br></div><div>><span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:14px"> image.convert('RGB')</span></div><div><font face="arial, sans-serif"><span style="border-collapse:collapse;font-size:14px">this code return converted image but abandoned</span></font></div>


<div><font face="arial, sans-serif"><span style="border-collapse:collapse;font-size:14px"><br></span></font></div><div><font face="arial, sans-serif"><span style="border-collapse:collapse;font-size:14px">Please rewrite as below</span></font></div>


<div><font face="arial, sans-serif"><span style="border-collapse:collapse;font-size:14px">> image = image.convert('RGB')</span></font></div><div><span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:14px"><br>


</span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/7/1 Matti Viljamaa <span dir="ltr"><<a href="mailto:mviljamaa@kapsi.fi" target="_blank">mviljamaa@kapsi.fi</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm trying to handle CMYK images by converting them to RGB. I'm using the following code snippet:<br>
<br>
import sys<br>
from PIL import Image<br>
<br>
def loadImage(self, imageFileName):<br>
    imageFile = open(imageFileName)<br>
    image = Image.open(imageFile)<br>
<br>
    if(image.mode == 'CMYK' ):<br>
        image.convert('RGB')<br>
<br>
However the image is not converted to RGB, although its mode is recognized as CMYK.<br>
<br>
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:<br>
    ValueError: unsupported image mode 'CMYK'<br>
<br>
So how can CMYK images be handled?<br>
<br>
My PIL is of version 1.1.6.<br>
<br>
_______________________________________________<br>
Image-SIG maillist  -  <a href="mailto:Image-SIG@python.org">Image-SIG@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/image-sig" target="_blank">http://mail.python.org/mailman/listinfo/image-sig</a><br>
</blockquote></div><br></div>