Author Topic: The Contraption 23: Add Exif to files  (Read 5583 times)

Francois

  • Self-Coat
  • *****
  • Posts: 15,766
The Contraption 23: Add Exif to files
« on: September 23, 2015, 11:28:36 PM »
Wow! Now that is a first! Two software contraptions published in two days!
Now this one is essentially the result of many days of slave labor from my part. Close to 1000 lines programmed in windows command script... ouch!
Like for every contraption, necessity is the mother of all invention... and this one is no different.

It all started with a simple yet stupid problem: I often use a cheap instant film scanner to put my images online. While the quality is not the best, it's good enough for online publishing. But the device has one annoying flaw: it doesn't have a built-in battery to keep the device's date. Worse, it doesn't even allow the user to change in in any way. As a result all the images come out as taken in January 1st, 2008 at 12:00
This might seem like a minor inconvenience but it burns my biscuits like you wouldn't believe. Problem is that all software use either the file's creation date or the EXIF date to sort the images correctly according to a normal timeline. No date variation and you're stuck with a pile of images taken on the same day at the same time... no good.

So at first I tried various programs which didn't do what I wanted them to. Then I stumbled on AnalogEXIF which it turns out is not too bad, but for some reason it sometimes forgets to tag some images and you're stuck doing it all over again. I though an upgrade could one day come to fix the various issues that come with it but sadly the project has been dropped.

There remained only one solution: DIY.

Having used before the fantastically good open source Eviv2 library, I decided to get back to it. And to build the front end, I opted for a language that is somewhat easy to work with but mostly easy to edit and to port to various versions of Windows. I settled on creating a DOS script... I figured that since this thing is so old and still present on today's computers, there are chances it will still be there for years to come.

And now I needed a way to build interactive menus, so I stopped my choice on the choice command which is available on all computers since the days of DOS (they actually removed it in XP but it's easy to find a copy of it and just add it back in the OS).

So I started coding, fumbling, chasing aggravating errors for days on end. On the first day I spent 4 hours just figuring out how to set the stupid date in the tags.
Then it was chasing various errors left right and center. The thing is there is no debugging mode in script files. You have to run them to verify them.

But now I've come to a point where I'm satisfied. I made it mostly for myself so I encourage you to tinker with it and adapt it to your needs. I've added a bunch of comments using the rem command, so if you have absolutely no scripting experience you can still find your way around the file and carry out some changes.

I find that editing it with Notepad++ is a great help since it colors various commands in different ways.

In order to run, you will need the Exiv2 library which is found here http://www.exiv2.org/download.html
You'll want the Windows executable.
Then you'll need my file which is found here
EDITED: SEE NEXT MESSAGE

Before using it, you will need to extract Exiv2 to a known folder that's easily accessed and edit the script file so that it points to it.
I also recommend you enter your name in one of the various blocks where the photographer tag gets written. You'll see it as I put a comment there.
Then you're ready to drag a folder on top of it and check it out. You can edit the file as you see fit and adapt it to your needs. In it, you will find mostly my own equipment and my stuff's serial information, but I left it there as a sample just so that you get the gist of how things work.

When editing the file, you will notice that the choice command I use generates what is called an errorlevel. It is very very important when you have multiple errorlevels in a menu to put them in reverse order like I did on the script. If you don't it won't work at all.

I hope you find this script useful :)
« Last Edit: November 06, 2015, 03:36:10 PM by Francois »
Francois

Film is the vinyl record of photography.

Francois

  • Self-Coat
  • *****
  • Posts: 15,766
Re: The Contraption 23: Add Exif to files
« Reply #1 on: November 06, 2015, 03:42:18 PM »
OK, I did a lot of modifications to my script and I cleaned it up a bit so that you can play with it.
Here's the new link
https://drive.google.com/file/d/0B1dmZoIlURfDamk2a25KMmk3d28/view?usp=sharing

Added features:
-automatic file renumbering up to 99 jpegs
-GPS location
-35mm lens equivalence calculator for other formats, useful when you are editing the script. It runs when you start the script by simply double clicking on it.

It's still compatible with the old way of doing things, it simply does more. So if you use your own modified version of the script, you can just copy and paste the various sections into this new version...

Enjoy!
Francois

Film is the vinyl record of photography.