Tuesday, March 24, 2015

GIF Animations in LabVIEW


One of the first things a LabVIEW programmer working with images would notice is the lack of support for making GIF animations.  Licensing issues for the Lempel-Ziv-Welch (LZW) algorithm, (a loss-less compression algorithm) used in the GIF format has been an impediment to adding support for GIF animation in many products.
The GIF format for images in mainly popular because of its capabilities to produce a light weight animation file that is seamlessly supported by most popular web browsers. This feature makes GIF animations a very useful tool for presentations and documentation. Multiple animations, each created from images using cameras placed on laser beam line experiments, is one of the uses we came across for GIF animations in LabVIEW.

PROBLEM:  How to make GIF Animations in LabVIEW?

SOLUTION: LabVIEW wrapper around NGif assembly for .NET. using the .NET constructor node.

The linked article (NGif) and the associated code is licensed under the The Code Project Open License (CPOL). The project downloadable from here shows the use of a .NET Assembly using the NGif project. We have provided an example VI (main.vi) with the project to demonstrate the use of the "create GIF animation" VI. Note: main.vi uses the JKI Lib State Machine.

The "create GIF Animation" VI incorporates the wrapper code for the NGif animator assembly as shown in the following figure.
Create GIF Animations in LabVIEW using NGif .NET Assembly


Also included in the example project, is a VI that wraps around the image format functions from .NET System.Drawing (4.0.0.0) assembly that can be used to convert images from one format to other.

Convert Image Format

Disclaimer: 
We hope this is a useful tip for LabVIEW users. However, users who intend to use the LZW compression algorithm in software intended for distribution should follow the appropriate licensing procedures. Wakefield Engineering LLC is not liable for any copyright, patent or license infringements w.r.t the use of the techniques presented in this article.

Download Link


2 comments: