Example Code

Building and Reading Grayscale U16 PNG files using IMAQ

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.

    Software

  • Vision Development Module
  • LabVIEW

Code and Documents

Attachment

Overview

Demonstrates how to write U16 grayscale image data to a PNG file, and how to read the image data back from the file.

Description

This example demonstrates how to write 16 bit grayscale pixel values to PNG files with correct PNG header information, so the file can be read properly by LabVIEW or other programs.

Hardware and Software Requirements

LabVIEW 2016 (or compatible) and the Vision Development Module

Steps to Implement or Execute Code

1. Unzip the attached file.

2. Open the project.

3. Open the Write Grayscale PNG File.vi and follow the instructions on its panel.

4. Open the Read Grayscale PNG File.vi and follow the instructions on its panel.

Additional Information or References

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