Example Code

Make Color Map for Image Manipulation

Code and Documents

Attachment

Overview

This SubVI takes in the percentage of Red, Green, and Blue from an image and creates a Color Map that can be applied to any 8 bit image using Flatten Pixmap.

Description

The Create Color Map.vi creates a scaled color mask that is applied to the 8-bit BMP image file's color properties. By using a scaled color percentage for Red/Green/Blue, which are found by converting each vaule to an 8-bit unsigned integer, ranging from 0-255, the values are returned as a 1D array of colors. This array, is then fed into the image data colors element of the Bundle by Name, and it is then flattened into a pixmap for image display.

Caveats and Additional Notes

Color Maps will not work on 24+ bit images.

Steps to Implement or Execute Code

  1. Specify the path to your desired 8-bit BMP file on the Color Map Demo.vi Front Panel
  2. Run the VI
  3. Change the RGB percentage sliders to manipulate the image

Requirements

Software

LabVIEW 8.6 or later

Additional Images or Video

color map demo.PNG

VI Snippet

ColorMap.pngCreate Map.png

**This document has been updated to meet the current required format for the NI Code Exchange. For more details visit this discussion thread**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors