Re: Problem with psd and Alpha

Fredrik Lundh <[email protected]>
Newsgroups gmane.comp.python.image
Message-ID <[email protected]>
On Thu, Aug 5, 2010 at 10:42 AM, Martino Massalini
<[email protected]> wrote:
> Hi, i'm tryng to composite several psd coming from my render software.
> Each one is a psd with  the same size of the others and an alpha channel.
> The problem is when i do
>
> im = Image.open("filepath")
>
> I alway get a "RGB" image instead of "RGBA" so i can't use the alpha channel
> as mask when i compose the image.
>
> Here some snippet:
>
>>>> im = Image.open("prova0000.psd")
>>>> im.mode
> 'RGB'
>>>> im.split()
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "/Library/Python/2.5/site-packages/PIL/Image.py", line 1497, in split
>    if self.im.bands == 1:
> AttributeError: 'NoneType' object has no attribute 'bands'

This is a bug in PIL 1.1.7 that affects all file formats; fix here:

   http://hg.effbot.org/pil-2009-raclette/changeset/fb7ce579f5f9

>>>> repr(im.im)
> 'None'
>>>> im.load()
> <PixelAccess object at 0x52160>
>>>> repr(im.im)
> '<ImagingCore object at 0x520f0>'
>>>> im.split()
> (<Image.Image image mode=L size=146x90 at 0x42C7B0>, <Image.Image image
> mode=L size=146x90 at 0x42C828>, <Image.Image image mode=L size=146x90 at
> 0x42C940>)

I think the problem here is that the PSD format stores the alpha in a
separate layer, that's not recognized by the PSD loader.

If you mail me a sample image, I can check if there's an easy fix for
this issue.

</F>
_______________________________________________
Image-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/image-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.