= Work with mattes = A _matte_ is a grayscale image you use as either an alpha channel or a [mask|/composite/masks] to isolate certain parts of the image. For example, if you wanted to crop an image inside a hexagon shape, you would create a hexagonal matte and connect it to the node's [mask input|/composite/masks] . [Image:images/matte_1.png] Mattes can be simple (a shape or a gradient) or complex, based on the colors in the image you want to use the matte on. tasks>> Generate mattes: * See [how to create shapes|shapes] , [gradients|fills] , and [generate mattes based on image colors (keying)|keying] . You can also [add noise|noise] to a matte to give it some variation. Use a matte to isolate part of an image: * Connect the matte to a node's [mask input|/composite/masks] . * Connect the image to the first input of a [Switch Alpha node|Node:cop2/switchalpha], and connect the matte to the second input. The Switch Alpha operator copies the second input to the alpha channel of the first input. Turn on the __Redo premultiply__ parameter to override any previous premultiplication. * Use the [Premultiply operator|Node:cop2/premultiply] to use a matte stored in a plane of the image you want to isolate. Use the name of the matte plane in the __Alpha__ parameter. * Connect the image to the input of the node generating the matte. In the __Image__ tab of the matte node's parameter editor, change the __Add image__ parameter to "C (RGB)" and "Multiply". Shrink or enlarge mattes: * Use the [Expand|Node:cop2/expand] or [Dilate Erode|Node:cop2/dilateerode] operator to shrink or enlarge mattes. The Dilate Erode operator is faster, but does not provide good quality for large changes. The Expand operator is slower, but produces higher quality. Adjust edges and falloff of a matte: * Because mattes are just grayscale images, you can use the full complement of image-manipulation tools in the compositor to adjust mattes. Use the [Gamma operator|Node:cop2/gamma] to reduce falloff at the low end (gamma < 1) or high end (gamma > 1). * Use an [Expand operator|Node:cop2/expand] with zero size and a small __Dropoff__ to add a bit of falloff to a map. * Use the [Blur operator|Node:cop2/blur] with a Gaussian blur to soften a matte. You can also use the [Edge Blur operator|Node:cop2/edgeblur], which blurs based on edge detection and so may preserve fine details of the map better. Combine mattes: * Use the [compositing operators|/composite/layers] to combine mattes. [Image:images/matte_combine.png] To get the union of two mattes, use the [Screen|Node:cop2/screen], [Maximum|Node:cop2/max], or [Add|Node:cop2/add] operator. To take the union but cut out overlapping areas, use the [XOR operator|Node:cop2/xor]. To get the intersection of two mattes, use the [Minimum operator|Node:cop2/min]. To cut one matte out of another, use the [Subtract operator|Node:cop2/subtract]. To use one operator to modulate another, use the [Multiply operator|Node:cop2/multiply].