How to Save 16-bit Grayscale Image with Rainbow Palette Info

Updated Nov 2, 2023

Environment

Software

  • LabVIEW
  • Vision Development Module

Driver

  • NI-IMAQ

I have a 16-bit image and I'm tring to save it with Rainbow Palette color, but the saved image remains in grayscale.
 

 

IMAQ GetPalette works with 256 element array. An unsigned 16-bit image has 65,536 possible values so IMAQ GetPalette function is not applicable. It is necessary to convert the unsigned 16-bit image to an unsigned 8-bit image.
The following code could be a possible solution:

Additional Information

  • You can use NI Vision Assistant to convert a unsigned 16-bit grayscale image to 8-bit grayscale image.
  • You can chose the Rainbow color right-clicking on the Image Display on Front Panel and selecting Rainbow under Palette section.