Example Code

Sort and Save Picture Files

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

As a photographer utilizing digital photography, I often end up with hundreds of photos to sort through, rename, rotate, and decide what to keep, what to delete, and what to archive.  To that end, I wrote a VI that allows me to browse through a folder of JPEGs, select which to delete, and select which to rename and save to a "Good" folder.  The VI utilizes a few of the Vision modules' functions, and will require you to have those modules installed.  It also utilizes a third-party EXIF data manipulation tool that will be discussed further below.

 

To run the VI, download either the 2012 or 8.6 version below.  Unzip the folder, open the project, and make sure the sub VIs and controls are still located in the project.

 

Navigate to http://www.sno.phy.queensu.ca/~phil/exiftool/ and download the Windows Executable zip folder.  Extract the files, rename exiftool(-k).exe to exiftool.exe.  Place exiftool.exe in the same folder as the photos you wish to process.

 

Launch Save Photographs Main.  The front panel and block diagram are pictured below.  Before running the VI, set the Path to Open From to be the folder containing your photos, and set the Path to Save To to be the folder you wish to keep the good photos in.  Then run the VI.  Use the front panel buttons to carry out your actions.

 

The exiftool serves to pull EXIF data from the original image file and apply the relevant information to the newly renamed and saved version.  This allows you to keep track of when the picture was actually taken.  While there is more EXIF data available than just time taken, I have decided not to include that data at this time.  Feel free to modify the code to include as much info as you wish.

 

NOTE: At this time, this VI is only compatible with JPEGs.  Some very simple changes to the code will allow it to be used with other files types - I will leave that up to you.

 

NOTE 2: For the EXIF data to function properly, the VI works best with images that are straight off your camera, and may still have names like "DSC04164.jpg."  If the EXIF or time stamp functionality is not working for your files, simply delete the sub VIs that perform these actions (Extract Time Taken EXIF and Write Time Taken EXIF) from the "Save As Good" case in Save Photographs Main.

 

Main Front Panel.png

 

Main Block Diagram.png

Patrick
CLA

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Andreas_Dahl
Member
Member
on

Thanks, I did something similar for sorting and storing my photos from my different cameras. The program stores photos and films by creating folders named by creation date and camera model on my server.

//Andreas