returns the alpha channel of image.


  • AlphaChannel[image] returns an image in which each pixel represents the opacity of the corresponding pixel in image.
  • If image has no alpha channel, the opacity of each pixel is assumed to be 1. »
  • AlphaChannel works with Image3D objects.

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 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).


open all close all

Basic Examples  (2)

Alpha channel of an image:

Click for copyable input

Alpha channel of a 3D image:

Click for copyable input

Applications  (3)

Properties & Relations  (3)

Introduced in 2010
Updated in 2012