Display Data URI as Image in LabVIEW

Updated Dec 4, 2023

Environment

Software

  • LabVIEW

A data URI is a base64 encoded string that represents a file. It always being present in the format of data:[<media type>][;base64],<data>This article will demonstrate how to display it as an image in LabVIEW.

  1. Download and install a Base64 decoder compatible with LabVIEW. Base64 decoder from JDP Science Common Utilities by JDP Science will be used in this article.
  2. Launch LabVIEW and create an empty VI.
  3. In the front panel, place a 2D picture control from Controls palette >> Graph >> Controls.
  4. In the block diagram, place the Base64 decoder (Base64 or Base64URL Decode.vi), which can be found at Functions palette >> Addons >> JDP Science Common Utilities >> Base64 Support.
  5. Place PNG Data to LV Image.vi located at Function palette >> Connectivity >> Web Services >> Conversion into the block diagram.
  6. Place Draw Flattened Pixmap.vi located at Function palette >> Graphics and Sound >> Picture Functions into the block diagram.
  7. Connect VIs inserted into the block diagram from Step 4 to Step 6 with the 2D picture control, as shown in the image below.
    connection
  8. Create a control for String In input of Base64 or Base64URL Decode.vi.
  9. In front panel, retrieve and insert data section of your data URI into string control created in Step 8.
  10. Run the VI and the image represent by the data URI will be shown in the 2D image control.