Example Code

Use the transparency information of PNG files with the LabVIEW Vision Development Module

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

The example demonstrates how to overlay an image with a transparent image.

 

Description

LabVIEW Vision Development Module (VDM) by default does not support transparency information within PNG files. However, PNG files can contain additional information specifying the level of transparency of every pixel, called alpha channel. Since the VDM does not support transparency the example sets a threshold to decide if a pixel will be displayed fully opaque or fully transparent. Depending on the previous evaluation the transparent image is projected onto an existing image at a certain position.

 

Requirements

 Software

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

 Hardware

  • No hardware is necessary to use this example VI

 

Steps to Implement or Execute Code

  1. Open the attached file
  2. Select whether the transparency of the overlay image shall be preserved
  3. Run the VI

 

Additional Information or References

Overlay PNG image with preserved transparency LV2012 NIVerified.vi - Front Panel.png 

 

Overlay PNG image with preserved transparency LV2012 NIVerified.vi - 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.**

Ashish Naik
Automotive Business Development Manager
National Instruments UK

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

Comments
mfitzsimons
Active Participant
Active Participant
on

Nicely done.  It would be useful if this was part of the standard vision library.  Good work around.

- Matt

Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison