SetAlphaChannel

SetAlphaChannel[image]

adds a fully opaque alpha channel to image.

SetAlphaChannel[image,a]

sets the opacity of all pixels to a.

SetAlphaChannel[image,aimage]

sets the alpha channel of image to aimage.

Details

  • 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].
  • SetAlphaChannel[image,] ignores opacity properties of image.
  • SetAlphaChannel works with images of explicit color spacesthat is, any setting of the ColorSpace option other than Automatic.
  • SetAlphaChannel works with 2D and 3D images.

Examples

open allclose all

Basic Examples  (1)

Set the pixel opacities in an image:

Scope  (7)

Add a constant white alpha channel to an RGB image:

Use an opacity of 0.5:

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:

Applications  (4)

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:

Properties & Relations  (1)

Color images are converted to grayscale when used as an alpha channel:

Interactive Examples  (1)

Use an alpha channel to focus on a region of interest in an image:

Wolfram Research (2010), SetAlphaChannel, Wolfram Language function, https://reference.wolfram.com/language/ref/SetAlphaChannel.html (updated 2012).

Text

Wolfram Research (2010), SetAlphaChannel, Wolfram Language function, https://reference.wolfram.com/language/ref/SetAlphaChannel.html (updated 2012).

BibTeX

@misc{reference.wolfram_2021_setalphachannel, author="Wolfram Research", title="{SetAlphaChannel}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/SetAlphaChannel.html}", note=[Accessed: 18-June-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_setalphachannel, organization={Wolfram Research}, title={SetAlphaChannel}, year={2012}, url={https://reference.wolfram.com/language/ref/SetAlphaChannel.html}, note=[Accessed: 18-June-2021 ]}

CMS

Wolfram Language. 2010. "SetAlphaChannel." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012. https://reference.wolfram.com/language/ref/SetAlphaChannel.html.

APA

Wolfram Language. (2010). SetAlphaChannel. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SetAlphaChannel.html