unexpected result when using Image.composite

View: New views
2 Messages — Rating Filter:   Alert me  

unexpected result when using Image.composite

by Laura & Edward Cannon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am using Image.composite to combine two images and am getting
unexpected results. Partially transparent areas are appearing
discolored. When I preform the same operation in the Gimp, the result
is as expected. A script demonstrating the problem is

import Image

fg = Image.open("a0001.png")
bg = Image.open("bg.png").resize(fg.size, Image.ANTIALIAS)
Image.composite(fg, bg, fg).save("out.png")


I have attached the source files for reference. Any insight into this
problem would be appreciated.
Edward Cannon



_______________________________________________
Image-SIG maillist  -  Image-SIG@...
http://mail.python.org/mailman/listinfo/image-sig

a0001.png (124K) Download Attachment
bg.png (284K) Download Attachment

Re: unexpected result when using Image.composite

by Laura & Edward Cannon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have discovered the source of the problem. the bg image is mode
RGBA, when I convert it to RGB, the result is as expected.

On Thu, Oct 15, 2009 at 9:55 PM, Laura & Edward Cannon
<cannon.el@...> wrote:

> I am using Image.composite to combine two images and am getting
> unexpected results. Partially transparent areas are appearing
> discolored. When I preform the same operation in the Gimp, the result
> is as expected. A script demonstrating the problem is
>
> import Image
>
> fg = Image.open("a0001.png")
> bg = Image.open("bg.png").resize(fg.size, Image.ANTIALIAS)
> Image.composite(fg, bg, fg).save("out.png")
>
>
> I have attached the source files for reference. Any insight into this
> problem would be appreciated.
> Edward Cannon
>
_______________________________________________
Image-SIG maillist  -  Image-SIG@...
http://mail.python.org/mailman/listinfo/image-sig