Save Multiple Images to Same Folder Using LabVIEW

Updated Mar 16, 2018

Reported In

Software

  • LabVIEW

Driver

  • Vision Acquisition Software

Issue Details

I am using LabVIEW to capture or read in images using IMAQ or IMAQdx VIs and I want to save these images into different folder based on different image criteria.  Within the different folders, I need to save multiple images, but I need each image to have a unique name because the images are overwriting each other and I end up with only one image after I run my program.  The program needs to be able to run alone with out user input to save each image.

Solution

To save images to disk you will need to use the IMAQ Write File 2 VI.  Since we are saving images programmatically and not with user input via a dialog box, we will need to make sure the image names are all unique.  There are two main ways to make unique names:  appending a number that increments to the end of the file name or to name the file by the date and time.

Appending a number that increments to the file name

  1. Create the base file name including the full file path.
  2. Use a Feedback Node with an increment node (or another source that will give incrementing numbers, such as the increment counter of a while loop) and wire the output into a Format Into String node
  3. Wire both the base file path and the output of the Format Into String node into Concatenate String.
  4. Wire the output of Concatenate Strings into String To Path.
  5. Wire the String To Path output into IMAQ Write File 2

Appending the date and time to the file name

  1. Create the base file name including the full file path.
  2. Use Format Date/Time String and make sure the time format string input is such that the output of the node does not include any forward or back slashes because they are not allowed in file names.
  3. Wire both the base file path and Format Date/Time String output into Concatenate String.
  4. Wire the output of Concatenate Strings into String To Path.
  5. Wire the String To Path output into IMAQ Write File 2

WAS THIS ARTICLE HELPFUL?

Not Helpful