VI Icon:Set From Image Data Method

Short Name: VI Icon.Set from Image Data

Requires: Base Development System

Class: VI Methods

To Use: Create a method.

Sets a VI icon from image data you specify. LabVIEW creates a user layer called VI Icon for the image and deletes any other existing icon information from the Icon Editor dialog box.

If you want to use a pixmap to set the icon, use the Flatten Pixmap VI to convert the data to an image data cluster before using this method. If you want to use a picture to set the icon, use the Picture to Pixmap VI to convert the data to an image data cluster before using this method. Use the Create Mask VI to make a certain color in the image data transparent before wiring the image data to this method.

This method converts the image data you wire to an input to the appropriate color depth. For example, if you wire 4-bit image data to the Color256 input, this method converts the image data to a color depth of 8-bit.

If you do not wire image data to the Color16 input, LabVIEW converts the image data you wire to the Color256 input to a color depth of 4-bit. If you do not wire image data to the Monochrome input, LabVIEW converts the image data you wire to the Color16 input, if available, to a color depth of 1-bit. Otherwise, LabVIEW converts the image data you wire to the Color256 input to a color depth of 1-bit.

If the image data you wire to this method describes an image larger or smaller than 32 × 32 pixels, the method resizes the image to 32 × 32 pixels.

You also can use the VI Icon:Set from File method to set a VI icon from an image file.

Parameters

Data typeNameRequiredDescription
Color256YesSpecifies image data to use as the 8-bit VI icon. The Icon Editor dialog box saves icons in both 256-color (8-bit) and monochrome (1-bit) format.
  • image type—Reserved for future use.
  • image depth—Specifies the color depth of the image, which is the number of bits to use to describe the color of each pixel in the image. Valid values include 1, 4, 8, and 24 bits per pixel. image depth affects how LabVIEW interprets the values of image and colors.
  • image—Array of bytes that describes the color of each pixel in the image in raster order. The value of image depth determines how LabVIEW interprets the value of this input. If image depth is 24, each pixel has three bytes to describe its color. The first byte for each pixel describes the red value, the second byte describes the green value, and the third byte describes the blue value.

    If image depth is 8, each pixel has one byte to describe its color. The value of each bit corresponds to an element in colors, which stores 32-bit RGB values where the most-significant byte is zero, followed in order by red, green, and blue values.

    If image depth is 4, the behavior is similar to when image depth is 8 except valid values in image include 0 through 15.

    If image depth is 1, any value of zero in image corresponds to element 0 in colors. All other values correspond to element 1 in colors.
  • mask—Array of bytes in which each bit describes mask information for a pixel. The first byte describes the first eight pixels, the second byte describes the next eight pixels, and so on. If a bit is zero, LabVIEW draws the corresponding pixel as transparent. If the array is empty, LabVIEW draws all pixels without transparency. If the array does not contain a bit for each pixel in the image, LabVIEW draws any pixels missing from the array without transparency.
  • colors—Array of RGB color values that correspond to the values in image. The value of image depth determines how LabVIEW interprets the value of this input. If image depth is 24, LabVIEW ignores this input. If image depth is 8, the array has 256 elements. If image depth is 4, the array has 16 elements. If image depth is 1, the array has 2 elements.
  • Rectangle—Cluster that contains coordinates that describe the bounding rectangle of the image, where the upper-left corner is at (0,0). The bottom right edges of the bounds does not include the image.
Color16NoSpecifies image data to use as the 4-bit VI icon. The Icon Editor dialog box saves icons only in 256-color (8-bit) and monochrome (1-bit) format. If you use this input to specify 4-bit image data for an icon, you can retrieve this data only by using the Color16 output of the VI Icon:Get As Image Data method.
  • image type—Reserved for future use.
  • image depth—Specifies the color depth of the image, which is the number of bits to use to describe the color of each pixel in the image. Valid values include 1, 4, 8, and 24 bits per pixel. image depth affects how LabVIEW interprets the values of image and colors.
  • image—Array of bytes that describes the color of each pixel in the image in raster order. The value of image depth determines how LabVIEW interprets the value of this input. If image depth is 24, each pixel has three bytes to describe its color. The first byte for each pixel describes the red value, the second byte describes the green value, and the third byte describes the blue value.

    If image depth is 8, each pixel has one byte to describe its color. The value of each bit corresponds to an element in colors, which stores 32-bit RGB values where the most-significant byte is zero, followed in order by red, green, and blue values.

    If image depth is 4, the behavior is similar to when image depth is 8 except valid values in image include 0 through 15.

    If image depth is 1, any value of zero in image corresponds to element 0 in colors. All other values correspond to element 1 in colors.
  • mask—Array of bytes in which each bit describes mask information for a pixel. The first byte describes the first eight pixels, the second byte describes the next eight pixels, and so on. If a bit is zero, LabVIEW draws the corresponding pixel as transparent. If the array is empty, LabVIEW draws all pixels without transparency. If the array does not contain a bit for each pixel in the image, LabVIEW draws any pixels missing from the array without transparency.
  • colors—Array of RGB color values that correspond to the values in image. The value of image depth determines how LabVIEW interprets the value of this input. If image depth is 24, LabVIEW ignores this input. If image depth is 8, the array has 256 elements. If image depth is 4, the array has 16 elements. If image depth is 1, the array has 2 elements.
  • Rectangle—Cluster that contains coordinates that describe the bounding rectangle of the image, where the upper-left corner is at (0,0). The bottom right edges of the bounds does not include the image.
MonochromeNoSpecifies image data to use as the 1-bit icon. The Icon Editor dialog box saves icons in both 256-color (8-bit) and monochrome (1-bit) format.
  • image type—Reserved for future use.
  • image depth—Specifies the color depth of the image, which is the number of bits to use to describe the color of each pixel in the image. Valid values include 1, 4, 8, and 24 bits per pixel. image depth affects how LabVIEW interprets the values of image and colors.
  • image—Array of bytes that describes the color of each pixel in the image in raster order. The value of image depth determines how LabVIEW interprets the value of this input. If image depth is 24, each pixel has three bytes to describe its color. The first byte for each pixel describes the red value, the second byte describes the green value, and the third byte describes the blue value.

    If image depth is 8, each pixel has one byte to describe its color. The value of each bit corresponds to an element in colors, which stores 32-bit RGB values where the most-significant byte is zero, followed in order by red, green, and blue values.

    If image depth is 4, the behavior is similar to when image depth is 8 except valid values in image include 0 through 15.

    If image depth is 1, any value of zero in image corresponds to element 0 in colors. All other values correspond to element 1 in colors.
  • mask—Array of bytes in which each bit describes mask information for a pixel. The first byte describes the first eight pixels, the second byte describes the next eight pixels, and so on. If a bit is zero, LabVIEW draws the corresponding pixel as transparent. If the array is empty, LabVIEW draws all pixels without transparency. If the array does not contain a bit for each pixel in the image, LabVIEW draws any pixels missing from the array without transparency.
  • colors—Array of RGB color values that correspond to the values in image. The value of image depth determines how LabVIEW interprets the value of this input. If image depth is 24, LabVIEW ignores this input. If image depth is 8, the array has 256 elements. If image depth is 4, the array has 16 elements. If image depth is 1, the array has 2 elements.
  • Rectangle—Cluster that contains coordinates that describe the bounding rectangle of the image, where the upper-left corner is at (0,0). The bottom right edges of the bounds does not include the image.

Remarks

The following table lists the characteristics of this method.

Data typeNo return value
Available in Run-Time EngineNo
Available in Real-Time Operating SystemYes
Settable when the VI is runningYes
Loads the front panel into memoryNo
Need to authenticate before useYes
Loads the block diagram into memoryNo
Remote access allowedYes
Must wait until user interface is idleNo
Available with control VIsYes
Available with global VIsYes
Available with strict type definitionsNo
Available with polymorphic VIsYes