How to edit MetaData in Images for Building Survey Information

  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

I had a thought of embedding metadata into images after a building survey. This would capture the surveyors comments on the survey and store them in the the actual image files. So the next time the photo is inspected in the office the information on that image is easily inspected. Rather than looking for 2 sources of information, the information is gathered in the one file.

The nice thing about the images is that it has a date for the time it was taken. So you have a date of when ta he photo was taken. If you also had the condition of a building element, such as wall finish say condition 2 at that time, you can extrapolate on what its current condition is and when it needs to be upgraded.

You can click on an image using Explorer, and if you choose Properties of the file, you can see, in the Details tab, the metadata in the image file. See this article about editing image information in Win 10.

In this example I have added some data to the Title TAG & the Comment TAG.

Batch updating image metadata using an Import File

The above example is all well and fine, but very tedious to manage all the images individually. A better method would be to do a BATCH UPDATE with a CSV file which is filled in and then pushed into a Folder of Images.

Resources & setup

I initially thought that Knime or RapidMiner would have a few nodes that would do this, but I came up blank on that. I then looked to Python, and there were a few packages that could do this, the PIL and Py3exiv2 packages seemed to come up more frequently in Stack Overflow.

I wanted a simple process that others could use so I had Python as a backstop and looked for other alternatives.

I did a search on the interwongle to look for tools for metadata editing and came across this article from Wikipedia.

I also did a search for Batch Updating from a source file and came across Exif Editor, which is free, but to do batch updates from CSV file is an add-in which is not, pricing here. So I didn’t explore that too thoroughly.

I came across a command line editor for free called Exiftool by Phil Harvey that reads, writes and edits meta information. The App Documentation is here, and the FAQ, which is useful, is here.

There are some resources on Youtube that can be found HERE.

The thing with command line interface is that they can be fiddly. You need to get your switches right and then the programme usually runs wonderfully, but you usually have to do a lot of testing to get what you want. Once in place you can write a simple procedure for others to follow.

In setting up Exiftool you  really need it on your path, in the video below it shows how you can do this, so that if you open up a command window you can type exiftool.exe and it’ll start the programme. (you can also put the exiftool.exe file in your C:/windows directory and the command line will find it there too.

Operation of exiftool.exe

There are a whole lot of option switches, see the list HERE.

This  FAQ on How do I export information from exiftool to a database?talks about setting up to export image file data to a CSV.

This FAQ on How do I import information from a database?talks about setting up to import data from CSV file to  image files. 

Process

The process is to export metadata from a directory of image files to a CSV. Then update the CSV file and then import the data back into the images in the directory that started with.

Once you have explored the structure of the data you can simplify the process to just filling in the correct data cells and then doing the import process.

My test setup.

I decided to use my panorama files as a test environment.  I found a directory without too many files (as its a test).

I then developed this string to paste on the command line. Go read the files in the  “C:\Users\drake\Pictures\LG360\MtVicMoon”  directory and export  ALL the metaData to the “Desktop\out7.csv”

exiftool -ALL -csv -r C:\Users\drake\Pictures\LG360\MtVicMoon> Desktop\out7.csv

One thing to note here, if you have whitespaces in your path it will break and wont run, you have to encapsulate the whole path in quotes:

exiftool -ALL -csv -r C:\Users\drake\Pictures\LG360\Royal prop mngmt> Desktop\out8.csv         (will NOT work)

exiftool -ALL -csv -r “C:\Users\drake\Pictures\LG360\Royal prop mngmt”> Desktop\out8.csv       (WORKS)

The export from this is as below (note, I have transposed the output so I can show column headers in the first row)

In this file there are no TAGS for” Title” or “Comment” as they are empty in the files.

So in this case, I will fill some information into these tags and re-export the information to CSV

This time, the Title & Comments Tags are in the list as there is some data in one of the image files.

So export:

exiftool -ALL -csv -r “C:\Users\drake\Pictures\LG360\Royal prop mngmt”> “C:\Users\drake\Pictures\LG360\out11.csv”  

You then need to alter the Title & Comments Tags in the other Rows for the other image files to your desired input and then

Import (after updating the CSV):

exiftool -csv=“C:\Users\drake\Pictures\LG360\out11.csv” “C:\Users\drake\Pictures\LG360\Royal prop mngmt”
and the results:

So the image files in the directory have had their metadata updated to reflect the changes in the CSV file.

Note, you need to leave all the other rows that you exported in the CSV file or it doesn’t seem to want to import the updated data.

Extra Metadata in files

There is an option in Exiftool to add your own tags, unfortunately I could not get it to put in new tags.

On the main page of Exiftools under “FEATURES” , 5 from the bottom state that :

Ability to add custom user-defined tags 

This takes you to the config demo file: https://www.sno.phy.queensu.ca/~phil/exiftool/config.html  that you cn cut/paste into a notepad file and save.

The first option is to rename it as a .ExifTool_config” and windows threw a wobbly trying to do this, so I used the >exiftool -config example.config 83.jpg method to try and create tags and then test using the  > exiftool -NewEXIFTag=”This is a new comment” 85.jpg but it would not recognise the tag. I even tried using the windows “” instead of the ‘ ‘ single quotes in the code but that didn’t work either.

I had previously been exploring redundant tags that I could use for my data, although their tag names are different, I could use a simple mapping process (in Excel, Knime etc) to re-map say “LensManufacturer” to “WassFinish”.  I found a few TAG’S  that could be used and tested them. I was looking for ones I could put text in, some were configured for integer/float/date and I couldn’t use them, but others I could.

This is the list of ones I found I could use (11):

CameraSerialNumber
Comment
Description
FlashManufacturer
FlashModel
LastKeywordXMP
LensManufacturer
LensModel
Rights
Subject
Title

I also found a link to some other ones : https://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Shortcuts.html I found that the IFDO ones are in the JPG images I was using, even the IFD0:PanasonicTitle & IFD0:PanasonicTitle2 (weird as its an LG camera). The ones in italics below require number/date so cannot be used, so  another 13:

IFD0:ImageDescription
IFD0:Make
IFD0:Model
IFD0:Software
IFD0:ModifyDate
IFD0:Artist
IFD0:Copyright
IFD0:Rating
IFD0:RatingPercent
IFD0:DNGLensInfo
IFD0:PanasonicTitle
IFD0:PanasonicTitle2
IFD0:XPTitle
IFD0:XPComment
IFD0:XPAuthor
IFD0:XPKeywords
IFD0:XPSubject
 

So a total of 24 text fields to use.

There is also this article that shows an awful lot of other Tag fields that can be used. I have not tested them so far.

A point about what metadata information is shown in windows explorer. When you are in file explorer and right click and go to Details tab, not all of these fields appear. If you fill in the field in one of the images using the command:

> exiftool -NewEXIFTag=”This is a new comment” 85.jpg

It will populate that field, and when you next export the directory to a CSV file the headers that have been filled out all show.

You could use a web file viewer such as this or this to upload your file to to read all the relevant metadata. But you end up wading through all of the other metadata to find what you are looking for.

I think the 3DPDF export Excel VBA macro process would be an effective way of processing the information from an image directory after a CSV export as it is easily shared and used, requiring little skill to extract the relevant information.

I think I would plan a bi-directional Excel macro mapping tool so that you had a simple table to fill in that you would then merge/overwrite the information in the Exported CSV from the Image file directory that you’d then import into the images. You’d use the reverse procedure when exporting the csv from the image directory.

The only specialist programme that you’d need to have installed is the ExifTool.exe file (8Mb). Skill level to run the Command line and basic excel macros. Not daunting technology & you could have a simple youtube video showing the complete process.

 End Comment

I think this is quite an elegant solution for capturing information in a relevant place as text/numeric information to back up the visual information you have from the photo itself. So mutually supporting each other.

Given the right data structure you could end up being able to push the data straight into your AMIS (Asset Management Information System) as a one off process as the data will be structured in a tabulated manner already.

I think there may be some simplification to the command line process using relative paths and using Window Explorer to navigate to the image file directly to simplify the command line prompt command.

I need to run a couple of more tests with JPG’s from different cameras (so far only used the LG 360 JPG images) to ensure that the same TAG’s are available in those files. Also maybe a TIFF and possibly other image file types. Exiftool seems to e able to manage an extensive range of file types.Tested on Sony camera jpg on one attribute & it works fine so far.

I also noted that it processes PDF files too. It only seems to export the Exif metaData which is pretty simple. It doesn’t seem to give you access to the actual programme data.

Add a Comment

Your email address will not be published. Required fields are marked *