From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

PNG Analyzer

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

  • LabVIEW

Code and Documents

Attachment

Download All

Overview

This VI will open the file and first check that it is a valid PNG file.  Then it will loop through the file extracting a chunk on each iteration.  It then displays an array of these chunks so you can see what additional information is in the file.

 

Description

The PNG file format is a "chunk" based format.  Within the file are several chunks of data.  The most prominent is the "IDAT" chunk which contains the image itself but the format allows for additional header information to be embedded behind the file.  As an example of where this happens, ever wondered how VI snippets work?  They embed the code as part of this header information.

There are certain standard chunk types and the format is fixed so you get the size, type, data and CRC data for each chunk.  For technical details check the Wikipedia page.

 

Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Run the VI.
  2. Choose a valid PNG file.
  3. Display an array of these chunks.

 

Additional Information or References 

Front Pane

Analyser front panel.pngVI Snippet 

151.png

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com

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