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.

LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
BruceAmmons

Add function to convert string to image

Status: New

Currently in IMAQ Vision, there is a function to convert an image to a standard formatted string (JPEG, PNG, etc.).  The contents of the string is exactly the same as the data that is normally written to a file.  This is a great function to compress an image and send it over FTP, etc.

 

The problem is that there is no inverse function available - you can't convert the string directly to an image.  The only way to do it is to save the string to a file, then read it as an image, which slows down the process significantly.

 

I repeatedly see the need for this function.  People receive strings from other devices or PCs and want to display them as images.

 

There are functions to flatten images to/from strings, but they are limited in their scope (JPEG and PNG only, I believe) and they include the image name and other information in the string.  The format is proprietary and can't be read by other programming languages (yes, some people still program in languages other than LabVIEW).  It is also difficult when you want to unflatten a string and store it in an image with a different name than it was stored with.

 

Bruce

 

[Update] Part of this idea for the PNG format was implemented for LabVIEW 2013. Please see this post for details.

Bruce Ammons
Ammons Engineering
22 Comments
muks
Proven Zealot
I had wanted this some 6 months back when i need to get the sensor ADC's output to be mapped to a image. Will be helpful in speeding things up.
UrsL
Active Participant

 

 

I second Bruce's idea. Actually I would like to get a set of basic image handling functions à la IMAQ-Vision in LabVIEW PDS cross platform too. Things like the image data type along with a basic set of format conversion, visualizing and manipulation functions for images. This would be practical because it gets increasingly common to work with images in conjunction with data acquisition.

 

Thank you

 

Urs

 

Urs Lauterburg

Physics demonstrator

Physikalisches Institut

University of Bern

Switzerland 

 

 



Lasnier
Member

Good idea.

 

-Charles Lasnier 

karpa
Member
i (and many others) definitely need this function i read images from ftp or othew tcp/ip sources and i cant make them as pictures object. i used a dirty solution but this is not the correct way to go. there are post in the forum from 2003 that asks this kind of function!
Ray.R
Knight of NI

Great idea Bruce,

 

Totally agree.  If you have a function to do a conversion one way, there should always be another function to do the inverse.

shew82
Member

There actually is something lurking in the Connectivity:Web Services:Utilities pallete in LabVIEW 2009 (it may be there in earlier versions, I'm not sure) - there are two VIs that let you convert between PNG data (as a string) and LV Images (non-IMAQ).

 

These work with true binary PNG data and do not contain any proprietory data or filenames etc.

 

Shaun

cosmin
Member

I put a utility subVI for on the fly conversion of jpeg strings to picture in developer zone.

http://decibel.ni.com/content/docs/DOC-13513

 

until a NI solution maybe this will help

 

Cosmin

Jane.Yu
Member

Support!

RavensFan
Knight of NI

Don't just say "Support!".  Show it by clicking on the Kudoes button.  That is what matters.  Save the messages for when you have something meaningful to add to the discussion of the idea, otherwise the message is just noise.

AristosQueue (NI)
NI Employee (retired)

As of LabVIEW 2013, there are functions that ship in the core LabVIEW to do this for PNG format.

Untitled.png