adds full opacity to color.
adds opacity a to color.
adds an alpha channel to image.
adds an alpha channel to frames of video.
- SetAlphaChannel returns an image with an alpha channel using either fixed opacity for all pixels or an image containing the opacity for every pixel. Alpha channels are typically used for highlighting regions of interest or masking the image.
- SetAlphaChannel[image] is equivalent to SetAlphaChannel[image,1].
- In SetAlphaChannel[image,a], a can be a scalar value or an image with the same dimensions as image.
- When setting opacity to a color or image, existing opacity properties are ignored.
- SetAlphaChannel works with any valid color directive as well as 2D and 3D images of explicit color space—that is, any setting of the ColorSpace option other than Automatic.
Examplesopen allclose all
Add a constant white alpha channel to an RGB image:
Specify the alpha channel using an image mask:
Specify the alpha channel using a grayscale image:
Specify the alpha channel using a color image:
Specify the alpha channel using a graphics object:
Add an alpha channel to a 3D image:
Segment the background to be used as an alpha channel:
Set the alpha channel to a detected background:
Use an alpha channel to mask regions of an image:
Use an alpha channel to highlight a region of interest:
Find individual cells that do not touch the border and have only one hole:
Highlight the detected foreground while keeping the background half transparent:
Set the alpha channel of an RGB image to be the negative of its blue channel:
Wolfram Research (2010), SetAlphaChannel, Wolfram Language function, https://reference.wolfram.com/language/ref/SetAlphaChannel.html (updated 2022).
Wolfram Language. 2010. "SetAlphaChannel." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/SetAlphaChannel.html.
Wolfram Language. (2010). SetAlphaChannel. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SetAlphaChannel.html