12

I have a PNG image that has many shades of gray and no transparency:

enter image description here

I would like to turn the grayscale into an alpha channel in Paint.net, so that the parts that are completely white would become completely transparent, the parts that are completely black stay the same and the gray parts become transparent black, so that the lighter they are the more transparent they become, for example it would turn RGBA(100,100,100,255) into RGBA(0,0,0,155).

I found this question about Photoshop, I would like to do the same thing but in Paint.net.

Is there a way to do this in Paint.net?

3 Answers 3

6

I was unable to create the desired effect with blending, but there is a plug-in that offers this functionality: Alpha Mask. (I have no association with the author.) Download the ZIP file and extract the DLL to this folder:

C:\Program Files\paint.net\Effects

That adds an Alpha Mask... entry to the Effects menu. Using that menu item produces an Alpha Mask Settings dialog. To make the black parts of the mask produce full opacity, check Invert Mask. If the target image (that will be masked) isn't fully opaque everywhere, you might want to check Mix Alpha. You can use a mask image on your clipboard or load it from a file.

settings dialog

Using your mask on my avatar, I get this image:

example masked image

(The result I got was actually transparent where appropriate, but that may have been lost in the upload.)

1

You could also use Alpha Space.

Starting from either white or black pixels, it makes them transparent the closer they are to the starting color. So for example, with your image, with this setting you keep the black with no transparency and the outer grays with a varying alpha level.

enter image description here

1
  • 1
    I love this, it's exactly what I needed. Commented Mar 20 at 18:43
1

Adding a further answer, as this is still one of the top Google results, and the plugin from the accepted answer is not recommended for the latest versions of Paint.NET. BoltBait's plugin pack (https://forums.getpaint.net/topic/113220-boltbaits-plugin-pack-for-pdn-v4212-and-beyond-updated-july-16-2020/) has an option under Effects->Object called "Paste Alpha" which achieves exactly what you're after. The process would be copy image to clipboard, select image/layer you'd like to mask, then Paste Alpha...

1
  • This works very well, and contains a whole bunch of useful plugins. There's even "Effects > Object > Switch Gray to Alpha" - which saves a few steps in what I wanted to do.
    – Kobi
    Commented May 9, 2022 at 12:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .