How to create a transparency mask? #2462
-
I'm a noob when it comes to image processing, but trying to learn the basics for a simple use case. I'm trying to create a size-optimized transparency mask out of a PNG image where I erased parts of the original image to leave transparent. I want to end up with a mask that is black everywhere that isn't transparent. So only 2 colors (Black and transparent). I'm just now learning the technical terminology, but my thought was to make a 2-color palette, with RGBA(0,0,0,0) and (0,0,0,1), and map the first color with a threshold of 0 and the second color to anything >0. How could I do this in code? Or is there an easier way? Thanks. So far what I've tried is mostly working, but it doesn't work with black parts in my images, and the mask color is grey.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think I figured it out after seeing the article about pixel buffers... so I'll put it here for anyone else, or if there is a better way to accomplish it let me know. Thank you.
|
Beta Was this translation helpful? Give feedback.
I think I figured it out after seeing the article about pixel buffers... so I'll put it here for anyone else, or if there is a better way to accomplish it let me know. Thank you.