Exchangeable image file format (officially Exif , according to JEIDA/JEITA/CIPA specifications) is a standard that specifies the formats for images, sound, and ancillary tags used by digital cameras (including smartphones), scanners and other systems handling image and sound files recorded by digital cameras. The specification uses the following existing file formats with the addition of specific metadata tags: JPEG discrete cosine transform (DCT) for compressed image files, TIFF Rev. 6.0 (RGB or YCbCr) for uncompressed image files, and RIFF WAV for audio files (Linear PCM or ITU-T G.711 μ-Law PCM for uncompressed audio data, and IMA-ADPCM for compressed audio data). It is not used in JPEG 2000 or GIF.
In order to access this data, you’ll need to interpret the image itself. To automate this Exif extraction, you can easily use Linx to work through each image with a small command-line utility called Exiftool.
Download the completed solution for Linx 5.20 here: EXIFExtractor.lsoz (8.7 KB)
Steps to recreate:
- First, download and install the Windows Executable from Exiftool.org.
- Extract Exiftool and rename the exe file to “exiftool.exe”
- Start a new solution in Linx Designer
- Add a Setting for the full path to the “exiftool.exe” file:
Add a new Function to your solution called PullExifData (this will be the re-usable function to extract Exif data into an easily accessable List of Name and values.)
Create a new Type called “NameAndValue” with 2 string properties called “Name” and “Value”:
Back, on your PullExifData Function, add a String Parameter field for this function for “ImageFullPath”
Add a Result field for the PullExifData function called “ListOfEXIFData” which is a List < NameAndValue > (A list of the Type we created a couple of point above.)
The full flow of the PullExifData function will look like this:
FullCMD is a String, with a value of the Command that needs to be executed:
=$.Settings.ExifToolPath + " " + $.Parameters.ImageFullPath
CommandLine runs the String above and provides an Output as text.
ListOfLines takes the String from the CommandLine and splits it into each line as a String, by cutting off each line at the NewLine point ($.System.NewLine):
ListOfNamesAndValue is just an empty list, of the Type we created earlier called “NameAndValue”
In the “ForEach” we will loop through the ListOfLines
For each Line of the ListOfLines, we first Split the value again into a small String List called NameAndValueInList. Each Line contains a “Name : Value” pair, separated by a colon (:).
- Because some lines from the ListOfLines may be empty or not contain a “Name : Value” pair, we do a “ValueExists” if-else check. The condition we are checking for basically check if the Split(":") was successful in creating 2 values (and as such a “:” was present and a Name and Value was extracted.
- Now we can finally add the extracted Name and Value to the ListOfNamesAndValues list with AddToList:
- At the end of the function, SetValueResult saves our populated list as the Result of the Function:
This gives us everything we need to extract Exif data from a photo, and we can use this function in any other Function to get specific data. For example, if I want to extract Exif Data called “User Comment” and save it to a Database:
Some example data from a photo: