Dot Jim

Search
Skip to content
  • C#
  • Need coffee
  • Stories from the field
  • Powershell
  • How-to
  • Databases
  • Finance, Law and Activism
  • About

Monthly Archives: August 2021

Tutorials and guides

EXIFTOOL: How to add the time and place to scanned photos

August 9, 2021 Jim Leave a comment

This is one I’m going to need every holiday season 🏖️☀️🏊😊

Every time I go for summer holidays I end up, one way or another, with a bunch of photos. You know, actual photos. The paper type. And lovely -in an old-timey way- as they may be, one cannot easily display it on one’s laptop, phone, tablet etc etc.

Sure, there are ways, but…

So what I do is scan them and upload them to the cloud. But then I have another problem: the date of the photos is not correct, and there’s no GPS location info (the so-called metadata). My cloud photo app doesn’t display it on the right “On this day” day. I also cannot find it by searching for e.g. “Cyprus” (where the photo above was taken, a looong time ago) and it won’t get shown when I create a map of where I’ve been.

First world problems, I know, but still. I googled around and found the solution using exiftool and touch (on linux) or powershell (on windows).

As a prerequisite, you need:

  • For Linux: install exiftool using sudo apt install exiftool
  • For Windows: download and install exiftool from here.

Next step is that, every time I have a new batch of scanned photos, I have to decide when and where they were taken. For old photos, this takes some guesswork but that’s ok -it doesn’t have to be 100% accurate.

Then I go to Google Maps and find the place they were taken in. Again, I don’t need it to be 100% correct. In the case of the photo above “somewhere in Larnaca” is good enough -that’s where we went for our customary end-of-highschool 5-day trip. After I find a suitable place I click on it and copy the coordinates.

Note that the these coordinates need an addition. You need to specify if you’re on the northern or southern hemisphere (i.e. above or below the equator) and west or east of the prime meridian (i.e. left or right of Greenwich, England).

In my case, Cyprus is on the northern hemisphere (N) and east of the prime meridian (E), so the correct way to write these coordinates is 34.914722N, 33.638000E. You can paste it in Google Maps to verify if it’s correct:

Now that we have our date (say, 15th of April 1993) and place (say, 34.914722N, 33.638000E) we’re ready. The process is quite simple:

  • On Windows
  1. Open a Powershell command prompt
  2. cd C:\where\the\photos\are
  3. Change the Modify Date:
gci *.jpg | % { $_.LastWriteTime = Get-Date -Date "1993-04-15 12:00:00" }
  1. Tag the photos:
exiftool -P "-GPSDateStamp<filemodifydate" "-datetimeoriginal<filemodifydate" -GPSLongitudeRef=E -GPSLongitude=33.638000 -GPSLatitudeRef=N -GPSLatitude=34.914722 -GPSAltitude=10 -GPSAltitudeRef=1 -city="Larnaca, Cyprus" *.jpg
  • On Linux
  1. Open a command prompt
  2. cd /where/the/photos/are
  3. Change the Modify Date:
touch -d 1993-04-15 *.jpg
  1. Tag the photos:
exiftool -P "-GPSDateStamp<filemodifydate" "-datetimeoriginal<filemodifydate" -GPSLongitudeRef=E -GPSLongitude=33.638000 -GPSLatitudeRef=N -GPSLatitude=34.914722 -GPSAltitude=10 -GPSAltitudeRef=1 -city="Larnaca, Cyprus" *.jpg

Note that the Northern/Southern and Western/Eastern (N and E in this case) are given separately in the GPSLatitudeRef and GPSLongitudeRef parameters respectively. Also note that, for completeness, I’ve added a height (GPSAltitude) of 10 meters.

Obviously you might change the filter (in my case I tagged all the jpg photos in the folder) but otherwise, that’s it. This is what they look like in my cloud photo app (I use amazon photos):

Yes that’s me, 22 years and 14 kilos ago

Have fun ☺️

exiftoolgpsholidayshow-tometadataphotostimestamp

Software, Greece, Switzerland. And coffee. LOTS of coffee !

Recent Posts

  • SQL Server: How to backup all databases with a timestamp
  • Signs that you need coffee, #9
  • RabbitMQ: How to publish (upload) a file to a queue via Powershell using REST
  • Public Service Announcement, #2
  • New version of XMLSlurper: 2.0

Recent Comments

Maxime on RabbitMQ: How to move configur…
Jim on RabbitMQ: How to move configur…
Peter on RabbitMQ: How to move configur…
Peter on RabbitMQ: How to move configur…
Jim on RabbitMQ: How to move configur…

Archives

  • March 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • August 2021
  • July 2021
  • May 2021
  • March 2021
  • January 2021
  • August 2020
  • June 2020
  • May 2020
  • January 2020
  • November 2019
  • September 2019
  • August 2019
  • July 2019
  • May 2019
  • March 2019
  • February 2019
  • January 2019
  • December 2018
  • November 2018
  • October 2018
  • May 2018
  • February 2018
  • May 2017
  • December 2016
  • November 2016
  • May 2016
  • April 2016
  • January 2016
  • November 2015
  • October 2015
  • December 2014
  • November 2014
  • July 2014
  • March 2014
  • February 2014
  • October 2013
  • September 2013
  • July 2013

Categories

  • Coffee
  • Cryptography
  • Databases
  • Epic fail
  • Facepalm
  • Finance
  • Greece
  • health
  • In Greek
  • Internet
  • Law
  • Logic
  • Politics
  • Post-truth
  • Security
  • Software
  • Switzerland
  • Tutorials and guides

Meta

  • Register
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.com
Create a website or blog at WordPress.com
  • Follow Following
    • Dot Jim
    • Join 35 other followers
    • Already have a WordPress.com account? Log in now.
    • Dot Jim
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...