Example Code

Convert an IMAQ Image

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.


  • Vision Development Module
  • LabVIEW

Code and Documents



The example demonstrates how to convert a image to a different image type.



The example opens any supported image format (BMP, TIFF, JPEG, JPEG2000, PNG, AIPD) as a selectable image type (e.g. Grayscale U8, RGB U32).

The image can be converted to another image type that is used to save the image to a selectable image format (BMP, JPEG, JPEG2000, PNG, TIFF). Some image output formats can be configured with additional parameters that influence image quality and file size.

Please be advised that not every image format supports every image type, so please make sure the selected target image type is compatible.




  • LabVIEW 2012 Base Development System (or compatible)
  • Vision Development Module 2012 (or compatible)


  • No hardware is necessary to use this example VI


Steps to Implement or Execute Code

  1. Open the attached file
  2. Select the path of the image to convert
  3. Select the Image Format tab (optional: change the image quality/compression settings)
  4. (Optional) Change the Image Type for the Source and Target Image
  5. Run the VI
  6. Converted Image will be saved in the same folder as the Source Image and will have a ' (converted)' suffix


Additional Information or References

IMAQ Convert Image - Front Panel.png


IMAQ Convert Image - Block Diagram.png



**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text 'NIVerified'. Read here for more information about the new Example Guidelines and Community Platform.**

Zach C.
Field Engineer
Greater Los Angeles

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


modified 2010 vi to save in same path and file name with new extension

LeMur Technology Services, LLC