Create Mask VI
- Updated2025-07-30
- 8 minute(s) read
Applies a mask to an image and returns the mask information in the mask element of image data. This VI is useful if you want to make a certain color in an image transparent before writing the image to a 2D picture control.

Inputs/Outputs
image data
—
image data returns information about the image so you can use the Draw Flattened Pixmap VI to draw it as a picture.
Mask Color (Black)
—
Mask Color is the color in the image you want to appear transparent for 24-bit, 8-bit, and 4-bit images. You can wire a color box constant to this input.
1-Bit Mask Value (T)
—
If 1-Bit Mask Value is TRUE (default), the VI draws all elements in the image array with an index of 1 as transparent. If FALSE, the VI draws all elements with an index of 0 as transparent. The VI ignores this input if image data does not describe a 1-bit image.
Combine Masks? (F)
—
If Combine Masks? is TRUE, the VI combines any existing mask information for the image and the mask information you wire to this VI and applies all the mask information to the image. If FALSE (default), the VI applies only the mask information you wire to this VI.
image data
—
image data describes the image you want to draw or manipulate.
|
Use the Flatten Pixmap VI to convert a pixmap to a cluster you can wire to image data. If the image is 4-bit, 8-bit, or 24-bit, wire a color to the Mask Color input. If the image is 1-bit, wire a value to the 1-Bit Mask Value input.
Examples
Refer to the following example files included with LabVIEW.
- labview\examples\Graphics and Sound\2D Picture Control\Using Mask with Picture.vi
image data
—
image type
—
image
—
colors
—
Rectangle
—
left
—
Mask Color (Black)
—
1-Bit Mask Value (T)
—
image data
—
image type
—
image
—
colors
—
Rectangle
—
left
—