AlphaChannel
✖
AlphaChannel
Details

- AlphaChannel returns an image in which each pixel represents the opacity of the corresponding pixel. Alpha channels are typically used for highlighting regions of interest or masking the image.
- If the input has no opacity, the opacity of color or all pixels of image is assumed to be 1. »
- AlphaChannel works with any valid color directive as well as 2D and 3D images.

Background & Context
- AlphaChannel gives the matte associated with an image that locally specifies opacity. It is therefore useful for combining an image with a background where the contribution from the image and the background vary across the image.
- AlphaChannel returns a grayscale image whose pixel values are an array of real numbers between 0 and 1 inclusive. Here, 0 indicates the image is fully transparent and 1 indicates it is completely opaque. The pixels of an alpha channel are in one-to-one correspondence with the pixels of its associated image and are stored as a separate “channel” in the same file as the image data.
- If an image does not have an explicit alpha channel, AlphaChannel returns an image of all 1s, i.e. one that is completely white. SetAlphaChannel can be used to add or modify an alpha channel in an image and RemoveAlphaChannel can be used to remove an alpha channel. ImageChannels will return a count one larger for an image containing an alpha channel compared to an image without one.
- While an alpha channel specifies opacity (visibility) of individual pixels in an image, the graphics directive Opacity may be used to specify the level of opacity for graphics primitives in the Wolfram Language. Unlike an alpha channel, Opacity is not stored as a part of the graphics primitives themselves. It can therefore be applied to entire collections of graphics expressions (as opposed to a single image).
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Scope (2)Survey of the scope of standard use cases
Applications (3)Sample problems that can be solved with this function
Visualize an image background by negating its alpha channel:

https://wolfram.com/xid/01y53ad3h7q-pag66i


https://wolfram.com/xid/01y53ad3h7q-yodibd

Alpha channel is used for separating foreground from background:

https://wolfram.com/xid/01y53ad3h7q-sphvua

Extract the alpha channel corresponding to the foreground:

https://wolfram.com/xid/01y53ad3h7q-i2b532

Compute the area of the foreground:

https://wolfram.com/xid/01y53ad3h7q-qirmi7

Count number of foreground components using the alpha channel:

https://wolfram.com/xid/01y53ad3h7q-uvhlcy

Count the number of connected components:

https://wolfram.com/xid/01y53ad3h7q-1mqz6l

Properties & Relations (2)Properties of the function, and connections to other functions
Verify if an image has an alpha channel:

https://wolfram.com/xid/01y53ad3h7q-evsjkd

The alpha channel of a completely opaque image is white:

https://wolfram.com/xid/01y53ad3h7q-h50h1a

Alpha channel is returned as a grayscale image:

https://wolfram.com/xid/01y53ad3h7q-hyx0k5

Alpha channel has the same data type as the image:

https://wolfram.com/xid/01y53ad3h7q-kxmxk

Wolfram Research (2010), AlphaChannel, Wolfram Language function, https://reference.wolfram.com/language/ref/AlphaChannel.html (updated 2022).
Text
Wolfram Research (2010), AlphaChannel, Wolfram Language function, https://reference.wolfram.com/language/ref/AlphaChannel.html (updated 2022).
Wolfram Research (2010), AlphaChannel, Wolfram Language function, https://reference.wolfram.com/language/ref/AlphaChannel.html (updated 2022).
CMS
Wolfram Language. 2010. "AlphaChannel." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/AlphaChannel.html.
Wolfram Language. 2010. "AlphaChannel." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/AlphaChannel.html.
APA
Wolfram Language. (2010). AlphaChannel. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AlphaChannel.html
Wolfram Language. (2010). AlphaChannel. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AlphaChannel.html
BibTeX
@misc{reference.wolfram_2025_alphachannel, author="Wolfram Research", title="{AlphaChannel}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/AlphaChannel.html}", note=[Accessed: 25-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_alphachannel, organization={Wolfram Research}, title={AlphaChannel}, year={2022}, url={https://reference.wolfram.com/language/ref/AlphaChannel.html}, note=[Accessed: 25-April-2025
]}