Harris Hu Posted January 8 Report Posted January 8 I received some image data from a web API in Base64 format. Is there a way to load it into LabVIEW without generating a local file? There are many images to display, and converting them to local files would be cumbersome. base64.txt is a simple example of the returned data. image/jpeg base64.txt Quote
ensegre Posted January 8 Report Posted January 8 (edited) I haven't tried any of them, but these are the first 3 results popping up from a web search: https://forums.ni.com/t5/Example-Code/LabVIEW-Utility-VIs-for-Base64-and-Base32Hex-Encoding-Using/ta-p/3491477 https://www.vipm.io/package/labview_open_source_project_lib_serializer_base64/ https://github.com/LabVIEW-Open-Source/Serializer.Addons (apparently the repo of the code of the previous one) Edited January 8 by ensegre typo Quote
ShaunR Posted January 8 Report Posted January 8 2 hours ago, Harris Hu said: I received some image data from a web API in Base64 format. Is there a way to load it into LabVIEW without generating a local file? There are many images to display, and converting them to local files would be cumbersome. base64.txt is a simple example of the returned data. image/jpeg base64.txt 4.3 kB · 1 download LabVIEW can only draw PNG from a binary string using the PNG Data to LV Image VI. (You'd need to base64 decode the string first) I think there are some hacky .NET solutions kicking around that should be able to do JPG if you are using Windows. Quote
Neil Pate Posted January 8 Report Posted January 8 (edited) The Weather Station example that ships with LabVIEW shows a bit of this. but the data is not Base64, its just a pure characters, Edited January 8 by Neil Pate 1 Quote
ensegre Posted January 8 Report Posted January 8 As for converting jpg streams in memory, very long time ago I have used https://forums.ni.com/t5/Example-Code/jpeg-string-to-picture/ta-p/3529632 (windows only). At the end of the discussion thread there, @dadreamer refers to https://forums.ni.com/t5/Machine-Vision/Convert-JPEG-image-in-memory-to-Imaq-Image/m-p/3786705#M51129, which links to an alternative WinAPI way. Quote
Harris Hu Posted January 8 Author Report Posted January 8 39 minutes ago, Neil Pate said: LabVIEW 自带的气象站示例就展示了这一点。 但这些数据并非Base64编码,而只是纯字符数据。 This is acceptable. Quote
ensegre Posted January 8 Report Posted January 8 You could also check https://github.com/ISISSynchGroup/mjpeg-reader which provides a .Net solution (not tried). So, who volunteers for something working on linux? 1 Quote
ShaunR Posted January 11 Report Posted January 11 (edited) On 1/8/2026 at 3:17 PM, ensegre said: You could also check https://github.com/ISISSynchGroup/mjpeg-reader which provides a .Net solution (not tried). So, who volunteers for something working on linux? There is an example shipped with LabVIEW called "Image Compression with DCT". If one added the colour-space conversion, quantization and changed the order of encoding (entropy encoding) and Huffman RLE you'd have a JPG [En/De]coder. That'd work on all platforms Not volunteering; just saying Edited January 11 by ShaunR 1 Quote
Rolf Kalbermatter Posted January 12 Report Posted January 12 On 1/11/2026 at 11:43 AM, ShaunR said: There is an example shipped with LabVIEW called "Image Compression with DCT". If one added the colour-space conversion, quantization and changed the order of encoding (entropy encoding) and Huffman RLE you'd have a JPG [En/De]coder. That'd work on all platforms Not volunteering; just saying You make it sound trivial when you list it like that. 😁 Quote
ShaunR Posted January 12 Report Posted January 12 (edited) 28 minutes ago, Rolf Kalbermatter said: You make it sound trivial when you list it like that. 😁 While we are waiting for Hooovah to give us a huffman decoder ... most of the rest seem to be here: Cosine Transform (DCT), sample quantization, and Huffman coding and here: LabVIEW Colour Lab Edited January 12 by ShaunR Quote
hooovahh Posted January 13 Report Posted January 13 On 1/12/2026 at 8:57 AM, ShaunR said: While we are waiting for Hooovah to give us a huffman decoder ... 😅 You might be waiting a while, I'm mostly interested in compression, not decompression. That being said in the post I made, there is a VI called Process Huffman Tree and Process Data - Inflate Test under the Sandbox folder. I found it on the NI forums at some point and thought it was neat but I wasn't ready to use it yet. It isn't complete obviously but does the walking through of bits of the tree, to bytes. EDIT: Here is the post on NI's forums I found it on. 1 Quote
Rolf Kalbermatter Posted January 13 Report Posted January 13 On 1/12/2026 at 2:57 PM, ShaunR said: While we are waiting for Hooovah to give us a huffman decoder ... most of the rest seem to be here: Cosine Transform (DCT), sample quantization, and Huffman coding and here: LabVIEW Colour Lab You seem to have done all the pre-research already. Are you really not wanting to volunteer? 😁 Quote
ensegre Posted January 13 Report Posted January 13 I haven't yet really looked into, but why not just wrapping libjpeg, instead of endeavoring the didactic exercise of G-reinventing of the wheel? Quote
ShaunR Posted January 13 Report Posted January 13 19 minutes ago, Rolf Kalbermatter said: You seem to have done all the pre-research already. Are you really not wanting to volunteer? 😁 Nope. It needs someone better than I. Quote
Rolf Kalbermatter Posted January 13 Report Posted January 13 6 minutes ago, ShaunR said: Nope. It needs someone better than I. I can understand that sentiment. I'm also just doing some shit that I barely can understand.🤫 Quote
ensegre Posted January 13 Report Posted January 13 (edited) Uhm. This is G-image. Am I missing something? Edited January 13 by ensegre Quote
ShaunR Posted January 13 Report Posted January 13 (edited) 55 minutes ago, ensegre said: Uhm. This is G-image. Am I missing something? OP is using LV2019. Nice tool though. Shame they don't ship the C source for the DLL but they do have it on their github repository. Edited January 13 by ShaunR Quote
ensegre Posted January 13 Report Posted January 13 11 minutes ago, ShaunR said: OP is using LV2019. Where do you get that from? Quote
ensegre Posted January 13 Report Posted January 13 (edited) So in LV>=20, using OpenSerializer.Base64 and G-Image. That simple. Linux just does not have IMAQ. Well, who said that the result should be an IMAQ image? Edited January 13 by ensegre 1 Quote
Harris Hu Posted January 14 Author Report Posted January 14 8 hours ago, ensegre said: So in LV>=20, using OpenSerializer.Base64 and G-Image. That simple. Linux just does not have IMAQ. Well, who said that the result should be an IMAQ image? This is excellent. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.