# Pulling Exif data from images and photos

**URL:** https://community.linx.software/community/t/pulling-exif-data-from-images-and-photos/511
**Category:** How To
**Created:** [January 26, 2021, 7:48am UTC](https://community.linx.software/community/t/pulling-exif-data-from-images-and-photos/511 "2021-01-26T07:48:25Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Dawie\_Botes](https://community.linx.software/community/user_avatar/community.linx.software/dawie_botes/32/288_2.png) [@Dawie\_Botes](https://community.linx.software/community/u/Dawie_Botes)
#### Post date: [January 26, 2021, 7:48am UTC](https://community.linx.software/community/t/pulling-exif-data-from-images-and-photos/511/1 "2021-01-26T07:48:25Z")

</div>

From [Wikipedia](https://en.wikipedia.org/wiki/Exif):

> **Exchangeable image file format** (officially **Exif** , according to JEIDA/JEITA/CIPA specifications) is a standard that specifies the [formats](https://en.wikipedia.org/wiki/File_format) for [images](https://en.wikipedia.org/wiki/Image), [sound](https://en.wikipedia.org/wiki/Sound), and ancillary tags used by [digital cameras](https://en.wikipedia.org/wiki/Digital_camera) (including [smartphones](https://en.wikipedia.org/wiki/Smartphone)), [scanners](https://en.wikipedia.org/wiki/Image_scanner) 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](https://en.wikipedia.org/wiki/Metadata_(computing)) tags: [JPEG](https://en.wikipedia.org/wiki/JPEG) [discrete cosine transform](https://en.wikipedia.org/wiki/Discrete_cosine_transform) (DCT)[[2]](https://en.wikipedia.org/wiki/Exif#cite_note-2) for compressed image files, [TIFF](https://en.wikipedia.org/wiki/Tagged_Image_File_Format) Rev. 6.0 (RGB or YCbCr) for uncompressed image files, and [RIFF](https://en.wikipedia.org/wiki/Resource_Interchange_File_Format) [WAV](https://en.wikipedia.org/wiki/WAV) for audio files (Linear [PCM](https://en.wikipedia.org/wiki/Pulse-code_modulation) or ITU-T [G.711](https://en.wikipedia.org/wiki/G.711) μ-Law PCM for uncompressed audio data, and [IMA](https://en.wikipedia.org/wiki/Interactive_Multimedia_Association)-[ADPCM](https://en.wikipedia.org/wiki/ADPCM) for compressed audio data).[[3]](https://en.wikipedia.org/wiki/Exif#cite_note-3) It is not used in [JPEG 2000](https://en.wikipedia.org/wiki/JPEG_2000) or [GIF](https://en.wikipedia.org/wiki/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](https://linx.software) to work through each image with a small command-line utility called [Exiftool](https://exiftool.org/).

> 📁 Linx 5.20 : [EXIFExtractor.lsoz](https://community.linx.software/community/uploads/short-url/zlYhrXcGA9pclRmsLv5qnEEtPQZ.lsoz) (8.7 KB)

> 📁 Linx 6.0.5 : [EXIFExtractor.zip](https://community.linx.software/community/uploads/short-url/w34005LguHp3d3hVX3VW7ngwA2t.zip) (10.2 KB)

**Steps to recreate:**

- First, download and install the Windows Executable from [Exiftool.org](https://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:

 ![Screenshot 2021-01-26 at 09.18.04](https://community.linx.software/community/uploads/default/original/1X/e44bdd4d631033bacebdb542424d516469349751.png)

**PullExifData Function:**

- 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):

> =CommandLine.Output.Split($.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 (:).

> =ForEach.Loop.Split(“:”)

- 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.

 ![Screenshot 2021-01-26 at 09.41.21](https://community.linx.software/community/uploads/default/original/1X/2265f8dc51d80dca0dfd2637be4fba55bcd0dd31.png)

- Now we can finally add the extracted Name and Value to the ListOfNamesAndValues list with AddToList:

![Screenshot 2021-01-26 at 09.42.56](https://community.linx.software/community/uploads/default/original/1X/a7c180ff1eea7ca9c021ed07b896b76387d3bd79.png)

- At the end of the function, SetValueResult saves our populated list as the Result of the Function:

 ![Screenshot 2021-01-26 at 09.44.37](https://community.linx.software/community/uploads/default/original/1X/36efca4e34f40c0d66de06e20a23b80610e8f25d.png)

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:

![Screenshot 2021-01-26 at 09.47.07](https://community.linx.software/community/uploads/default/original/1X/c159b5a9d39f9f8a96da27b94a7676712d523050.png)

Some example data from a photo:

 ![Screenshot 2021-01-26 at 09.51.35](https://community.linx.software/community/uploads/default/original/1X/78c840d81aae1b5d9e93efa77e5b4609fa3bcb3b.png)
