Lingo Dictionary > A-C > createMatte() |  |

createMatte()

Syntax

    imageObject.createMatte({alphaThreshold})

Description

This function creates and returns a matte object that you can use with `copyPixels()` to duplicate the effect of the matte sprite ink. The matte object is created from the specified image object's alpha layer. The optional parameter `alphaThreshold` excludes from the matte all pixels whose alpha channel value is below that threshold. It is used only with 32-bit images that have an alpha channel. The `alphaThreshold` must be a value between 0 and 255.

Matte objects aren't image objects; they are useful only with the `copyPixels()` function. To save time, if you plan to use the same image as a matte more than once, it's best to create the matte and save it in a variable for reuse.

Example

This statement creates a new matte object from the alpha layer of the image object testImage and ignores pixels with alpha values below 50%:

    newMatte = testImage.createMatte(128)

See also

`copyPixels()`, `createMask()`