Ask Your Question

PNG Images transparent background not properly rendered

asked 2012-08-17 05:13:11 -0500

ravi gravatar image

updated 2012-08-17 05:14:28 -0500

I have some png images and I want to render all images together. Like suppose I have two images: img1.png, img2.png such that img2 is rendered above img1.png and non-transparent pixel in img2 is visible and corresponding pixel in img1 are not visible. But if I take any only img2, its transparent background in not properly selected for mask creation or just for viewing.

Original image:

Image rendered by SimpleCV: There are some random thing appearing in this image.

edit retag flag offensive close merge delete


@kscottz for now I have created multiple binary mask manually based on the transparent region and covering region and then use image arithmetic operation to get the result but it has some issue in the edges of non-transparent objects. I will try and use this mask and blit functions.thanks for ur ans

ravi gravatar imageravi ( 2012-08-21 07:05:29 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2012-08-17 15:06:47 -0500

kscottz gravatar image

Hrm. Unfortunately we don't have native support for PNG transparency in SimpleCV. If you file a ticket for it on github I believe we should be able to get to it in version 2.0 when we have the freedom to really monkey with the underlying data structures and get better mask support. As a work around I suggest you use the mask and blit functions to achieve the desired effects. You can blit one image on another using a binary or grayscale mask that tells the function what areas are opaque or transparent. I think there is some spotty support for transparent PNGs in the drawing layer, but be aware support for the drawing layer will probably go away in 2.0 as we move to a more versatile rendering environment. If you point us to a repo on github I can help you debug the code and get you the desired effect.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2012-08-17 05:13:11 -0500

Seen: 617 times

Last updated: Aug 17 '12