We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexSuggestions & BugsSoftware Bugs › alpha channel lost after pixel copying
Page Index Toggle Pages: 1
alpha channel lost after pixel copying (Read 1138 times)
alpha channel lost after pixel copying
Sep 28th, 2006, 10:33am
 
I loaded a png image with transparent background, then copy its pixels to a new PImage. The alpha channel was lost - transparent pixels rendered as white.

I tried to use the copy() method, which displayed a different result - transparent pixels rendered as gray.

See result here: http://www.metaphorical.net/temp/image_test.gif

Code here: http://www.metaphorical.net/temp/image_test.pde

PNG image used: http://www.metaphorical.net/temp/test.png
Re: alpha channel lost after pixel copying
Reply #1 - Sep 28th, 2006, 4:02pm
 
You might consider using a mask to apply an alpha channel.  This way you can load the original image, copy it multiple times, and then apply an alpha mask to all of the copies:

http://processing.org/reference/PImage_mask_.html

For your mask, all you'll need is that same circle colored white (fully opaque) with a black background (fully transparent.)
Re: alpha channel lost after pixel copying
Reply #2 - Oct 1st, 2006, 11:46am
 
Thanks shiffman. That's indeed the workaround I'm using right now... but it's a bit more difficult since the images are doing rotations and scaling.
Re: alpha channel lost after pixel copying
Reply #3 - Oct 1st, 2006, 11:50am
 
Downloaded 0117. The bug was fixed -- hurray! Smiley
Page Index Toggle Pages: 1