Function Repository Resource:


Source Notebook

Interactively add alpha transparency to an image

Contributed by: Michael Sollami


returns an interface for creating alpha channel masks on image.

Details and Options

ResourceFunction["AlphaChannelSetter"] takes a single option, ImageSize.
ResourceFunction["AlphaChannelSetter"] provides an initial locator to select a start position about which to grow a region of alpha transparency, which is indicated with checkerboard pattern. The size of the region depends on both the structure of the image at the position of the Locator as well as the α Strength.
There are three sliders in the ResourceFunction["AlphaChannelSetter"] panel, which control the following parameters:
Smoothnessroughness of the boundary of the selected region (essentially a blur)
Softnesssharpness of the alpha gradient at the boundary of the selected region
α Strengthstrength of the morphological fill operation used to grow the alpha region
Once the desired alpha is set, there are three buttons in the ResourceFunction["AlphaChannelSetter"] panel that give the following actions:
Printprint the resulting image to an Input cell
Copycopy the resulting image to the clipboard
Add Locatorsave region state and start a new region
Note that clicking the AddLocator button cannot be undone, i.e. the previous region will be saved to the final image and the controls will only affect the new region.


Basic Examples (2) 

Interactively set the AlphaChannel of an Image:

(* Evaluate this cell to get the example input *) CloudGet[""]

Create an alpha channel using multiple locators:

(* Evaluate this cell to get the example input *) CloudGet[""]


Michael Sollami

Version History

  • 1.0.0 – 30 June 2020

Related Resources

License Information