# How to create static alpha masks of an image

I have an image of following type-

I want to create mask of the following type where the inside area is white and rest of it is black. How to do it?

• Again - edge detection. Or you can take out all perfectly black pixels and use those as an inverse to the mask (in this specific image it seems like it will work). Sep 29, 2019 at 13:17
• Could you please elaborate more on inversing black pixels?
– Mark
Sep 29, 2019 at 13:46
• Let's assume you create a new image which is black everywhere where the greyvalue (for example (r+g+b)/3) is lower than some threshold T, and white otherwise. So essentially: target(x,y) = dot(source(x,y),vec3(1)) < 3.0*T ? 1 : 0 Where you loop over all pixels. Sep 29, 2019 at 14:06