[Image-SIG] CMYK->RGB [was Re: PCX]

Greg Hamilton gregh at object-craft.com.au
Mon Aug 9 02:06:50 CEST 2004


Thanks Frederik,

That's fixed the problem.

Unfortunately I've found another curious quirk. I have a CMYK Jpeg file 
created with Photoshop which I need to convert to RGB. To do this I do 
something like:

Image.open("cmyk_image.jpg").convert("RGB").save("rgb_image.jpg")

The colour information in the resulting jpeg is wrong. Red is yellow, 
green is blue, grey is something akin to teal. Hopefully I'm doing 
something wrong.

Greg

On 04/08/2004, at 3:18 AM, Fredrik Lundh wrote:

> Greg Hamilton wrote:
>
>> I have a PCX image which I can't manipulate with PIL.
>>
>> The image loads without error. PIL identifies it as a mode '1' PCX 
>> file
>> and reads the image size correctly. Unfortunately the image content is
>> lost, I just get a black rectangle.
>
> turns out that the tile member isn't properly set up for images where
> the PCX xmin or xmax headers are non-zero.  here's a patch:
>
> Index: PIL/PcxImagePlugin.py
> ===================================================================
> --- PIL/PcxImagePlugin.py       (revision 1939)
> +++ PIL/PcxImagePlugin.py       (working copy)
> @@ -96,6 +96,8 @@
>          self.mode = mode
>          self.size = bbox[2]-bbox[0], bbox[3]-bbox[1]
>
> +        bbox = (0, 0) + self.size
> +
>          self.tile = [("pcx", bbox, self.fp.tell(), (rawmode, planes * 
> stride))]
>
>
>  # --------------------------------------------------------------------
>
>
>
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig
>



More information about the Image-SIG mailing list