Converting LabVIEW Image to PNG Data in NI Linux Real-Time Target

Updated Jun 28, 2024

Environment

Software

  • OpenG Libraries for LabVIEW

Operating System

  • Linux

This article outlines the steps to use OpenG toolkit's compression function to convert LabVIEW image to PNG data in NI Linux RT.

Before starting this guide, ensure OpenG which is a LabVIEW third party toolkit is installed in your PC.
 

Determine the Supported Compression Type

OpenG toolkit provides two main compression function for Linux which are call PKZip compression and Pigz compression. The method below is to check which compression method is suitable for the LabVIEW image.

1. Download the attached LV Image to PNG Data in Linux.zip file and unzip the content to a known location. This folder contains Create PNG Stream From Image VI which includes the compression function from OpenG toolkit.
2. Create a new LabVIEW project and add RT target to the LabVIEW project.
3. Next, add LV Image to PNG Data folder as Folder (Auto-populating...).
4. Expand the folder and deploy Test Save PNG VI to RT target. The LabVIEW image here is the boolean.
OpenG Compression.png
5. FTP or WebDAV into /home/lvuser/natinst/bin application directory and transfer the generated PNG files to host PC's local path.
6. Finally, determine the compression function that fits the LabVIEW image based on the generated PNG file.
OpenG Compression Image.png
 

Using Create PNG Stream From Image VI

1. Drag and drop Create PNG Stream From Image VI into the desired VI.
2. Wire the input.
3. Wire a Write to Binary File VI function on PNG Stream output to save the binary stream as a file in local RT directory.
PNG Stream from Image Code.png

After deploying the VI, no error should occur and the PNG file should be created without any distortion.
PKZip Picture.png