Function Repository Resource:

AlphaChannelSetter

Source Notebook

Interactively add alpha transparency to an image

Contributed by: Michael Sollami

ResourceFunction["AlphaChannelSetter"][image]

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.

Examples

Basic Examples (2) 

Interactively set the AlphaChannel of an Image:

In[1]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/84cb6811-6b69-4d3b-8106-ffa0e4d78537"]
Out[1]=

Create an alpha channel using multiple locators:

In[2]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/cd7b8f19-8537-42bf-b60f-165557599aa0"]
Out[2]=

Publisher

Michael Sollami

Version History

  • 1.0.0 – 30 June 2020

Related Resources

License Information