Home · Register · Join Upload & Sell

Moderated by: Fred Miranda
Username  

  New fredmiranda.com Mobile Site
  New Feature: SMS Notification alert
  New Feature: Buy & Sell Watchlist
  

FM Forums | Nikon Forum | Join Upload & Sell

  

Archive 2018 · EXIF update script

  
 
reggieb
Offline
• •
Upload & Sell: Off
p.1 #1 · p.1 #1 · EXIF update script


Hello! I've started a project that is still in its infancy, but I thought I'd share it with the community here so that like-minded people can hop on board and share tools and scripts that they code out for their photos.

I've just started writing some myself, and finished my first test script today. I plan to do some more useful scripts in the future, but this first one is designed to loop through a directory, and modify the EXIF info of any photos taken with my Sigma 500mm f/4 and update it to something a little bit more friendly.

Let me explain what I mean. When I upload a photo taken with a Nikon lens, I get a nice little blurb showing what lens was used, as seen below. Note that under the first photo, you see "Nikon AF-S Nikkor 300mm f/4E PF ED VR lens"

That's handy, everyone can see exactly what I used!

Annoyingly, the second photo is what it looks like when I shoot with my Sigma 500mm: "500 mm f/4 lens"

So I wrote a script that will loop through a folder of JPEGs and look for the line in the EXIF that corresponds to my 500mm, and change it to what you see in the third: "Sigma 500mm f/4 Sport"

More specifically, it creates a directory inside the specified directory called "AdjustedExif" and dumps identically named copies with the exif data updated. Note that it does add compression, and I'm going to update the script tonight or tomorrow to save at the highest possible quality, assuming the PIL Python library allows for such a change. But for web use, it should be OK. (EDIT: Alright, that was easy, it's updated to save in the highest possible quality, you can compress as desired later)

I plan to write scripts for my other third party lenses, but this is really a test. The next big thing I want to do is take the timestamps off of photos, and a corresponding GPS log provided by either my Bad Elf GPS device, or an Olympus TG-Tracker, and use them to add GPS coordinates to the metadata of my photos in a way that works more reliably than SnapBridge (and on older cameras)

Note that I don't know for sure that it will work on all cameras, though I think it should. The thing that might be different is the way that it names the lens in the metadata. But if you happen to want to use this and you find that it doesn't work with your cameras image files, a sample JPEG would be all I would need from you to get it working.

The file is really simple, and you would run it in the following way (and yes, I'll add a readme to the project, I just threw it up on Github this evening).

To use the script, you would have to have python installed and run the command in the following way:

Sigma500.py "E:/Photos/500 Sport Testing/JPEG"

Where E:/Photos/500 Sport Testing/JPEG is the directory where your photos live.

Once it finishes, you will find a folder inside that directory with your new photos.

Again, this project is in its infancy. This first script won't be useful to many people, but if even one person can use it, great! I plan to write more scripts that do similar things (as I mentioned above) and as I do I will update this post, and push them to the Git repo. Which can be found here: https://github.com/reggiebIV/PhotoProjects

If there's a lot of interest, and more contributors hop in, we might be able to share some pretty cool and useful tools.

Thanks for looking!

















Edited on Jan 08, 2018 at 08:32 PM · View previous versions



Jan 08, 2018 at 07:56 PM
arbitrage
Offline
• • • • • • •
Upload & Sell: On
p.1 #2 · p.1 #2 · EXIF update script


I can't help with scripts but I was wondering how you are even able to get that nice full exif for the Nikon 300PF lens? When I post shots with that lens it just says "300mm f/4 lens", no Nikon, no specifics like E PF. I looked through the 300PF thread and the large majority say what mine do but at least one person's exif says the same as yours above.

What program are you using to produce your jpegs? Maybe that is the issue and Adobe is writing out a less detailed exif??



Jan 08, 2018 at 08:13 PM
reggieb
Offline
• •
Upload & Sell: Off
p.1 #3 · p.1 #3 · EXIF update script


arbitrage wrote:
I can't help with scripts but I was wondering how you are even able to get that nice full exif for the Nikon 300PF lens? When I post shots with that lens it just says "300mm f/4 lens", no Nikon, no specifics like E PF. I looked through the 300PF thread and the large majority say what mine do but at least one person's exif says the same as yours above.

What program are you using to produce your jpegs? Maybe that is the issue and Adobe is writing out a less detailed exif??


Could be Adobe that's saving it that way, I use Capture One, this script could be easily modified for any lens. It just loops through checking each file for X, and changing it to Y if it finds it.

For anyone else, I'd gladly modify it for you if you're interested, just tell me what lens to modify it for, it would only take a few minutes. I probably wouldn't even need a JPEG, although that would let me test it. If you just post an image in this thread, I can probably lift what's there from that.



Jan 08, 2018 at 08:24 PM
reggieb
Offline
• •
Upload & Sell: Off
p.1 #4 · p.1 #4 · EXIF update script


To split it out from the long-winded OP, here are my planned scripts:

1. Beautify other lens' EXIF data (taking requests)

2. Get GPS data from GPS log (ie one provided by an Olympus TG-Tracker, an activity tracker like a GPS watch, or a Bad Elf GPS device), use timestamps to update photo metadata with GPS data

3. Loop through a directory and check the timezone of each photo, if they're different, present user with each present, and give them the option to update all photos in the directory to a single timezone (for those times you remember well in to a trip that you didn't change the timezone on one of your cameras)




Jan 08, 2018 at 08:39 PM
jbouchard
Offline
• • •
Upload & Sell: Off
p.1 #5 · p.1 #5 · EXIF update script


This is a really good idea, especially useful for non-cpu lenses. Which 50/1.4 (SC, ai-s)? I had a Zeiss 21/2.8 ZF without CPU, and since Nikon never made a 21mm lens, that isn't one of the options on the list. I used "20", and all my pics had 20mm in the exif. It bugged me.



Jan 16, 2018 at 08:29 AM
Chris Dees
Online
• • • • •
Upload & Sell: On
p.1 #6 · p.1 #6 · EXIF update script


Not to spoil your fun, but there's a LR plug-in called LensTagger for this.



Jan 16, 2018 at 09:57 AM
snapsy
Offline
• • • • • •
Upload & Sell: On
p.1 #7 · p.1 #7 · EXIF update script


FYI, exiftool allows you to perform EXIF queries and changes across multiple files.


Jan 16, 2018 at 10:02 AM





FM Forums | Nikon Forum | Join Upload & Sell

    
 

You are not logged in. Login or Register

Username       Or Reset password



This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.