03-23-2010 02:24 PM
The vi may have the old LV 7 image controls, which would need to be upgraded to LV 8 style image controls. Just replacing them on the front panel usually does the trick.
It is relatively simple to save the JPEG string to the disk, then load it back as an image. Not nearly as easy as direct conversion, though. There is a bit of a performance hit saving and loading from the disk, but I suspect it may be minor since the file may still be in buffers so you don't actually have to load it from the disk. I thought of creating a RAM disk for the save/load process, which might eliminate most of the overhead. It would just be much easier with a direct conversion function.
Bruce
03-23-2010 02:39 PM
Eric,
I have been asking for about 5 years now, and every year I have been ignored or told it would not be a useful function. Here is another official request:
Please add a function to convert strings (JPEG, PNG, etc.) back to images. The inverse function to convert an image to a string already exists. For example, we can convert an image to a JPEG string, but we can't convert the JPEG string back to an image. It would be the equivalent of reading the image from the string instead of a file.
The existing flatten image to string functions are nice, but they are limited. They can't convert strings that are standard formats, and they can overwrite existing images since the image name is included in the string. Why they use the image name in the string instead of the image passed into the unflatten string I will never know.
Over the years, I have seen many uses for the string to image function. Programs receive images as strings over FTP, from other computers, cameras, and other sources. The programs need to use the image immediately in most cases, so saving the string as an image file and loading it back it is rather tedious. It is also an awesome way to stream images to disk and later load them quickly. I have a program that turns 256 images into JPEG strings and saves them as an array in a single file. Reading them back (using IMAQ JPEG Decode) is fast and easy - load the string array from the file, then convert each string back to an image. I have total control over how much compression and loss is involved during the conversion, which also affects the speed.
I realize there is a lot more work besides the coding itself. I am just saying the coding part should be relatively easy, and the rest of it shouldn't be too bad.
Please help me try to get this on the list for this year's new features.
Thanks,
Bruce
03-23-2010 03:08 PM
NI should deffinetely do something!! even without to much doccumentation.. i mean like the jpeg decode .vi distributed from user to user but with correct implementation.. except from the weird sollution with writting and then reading again the image from file is there any other sollution..?
maybe to convert to png or something first..
03-26-2010 07:14 AM
Bruce,
Why dont you post this in the idea exchange?
03-26-2010 05:31 PM
i solved my problem for the time with this..
http://forums.ni.com/ni/board/message?board.id=200&message.id=21845
04-04-2010 08:02 PM
I posted an idea request for a function to convert strings back to images. Please vote for it at:
Thanks,
Bruce
04-05-2010 01:10 AM