shahine.com/omar/

homepage | Send mail to the author(s) contact

yet another Microsoft blogger

# Friday, July 21, 2006

GPS Fun with Adobe...

So, as you may recall, I'm into Geotagging my photos. Whenever I go somewhere cool, I take a long my Garmin GPS receiver, and keep a tracklog of my trip. When I return I then use the WWMX tools to download the tracks and apply the GPS coordinates to my photos. This uses the magic of matching up your GPS "breadcrumbs" with the date/time in the photos. Special care needs to be taken with timezones though.

So, things seem great... until I realize that I can only apply the Geocoding data to JPG files because the WWMX tool is a .NET Application and System.Drawing doesn't know squat about any RAW photos. To make matters worse, I now shoot with two cameras that produce two different RAW formats (NEF and Panasonic). Only one tool can open these puppies up... Photoshop and its Camera Raw Plugin.

So, I have a bunch of JPG files with GPS coordinates. But what I really want is a way to get that data into the original RAW files (for reasons that I hope are obvious). Well after some hacking with Adobe's ExtendScript Toolkit (basically a JavaScript Object Model for Bridge and other apps) I figured out how to get all the GPS data from the JPG to the RAW file (I'll post this script at some point for those that want it). Super Cool right? Wrong. It just so happens that when you convert the RAW photo back to a JPG, all the EXIF data EXCEPT the GPS data is saved. WTF? What kind of bug is that? It seems Photoshop or Adobe Camera Raw takes a lossy approach to my metadata. I just burned a few hours trying to get this precious data into the file format that is meant for preservation, archival, developing and all that stuff and now it won't make it back out to the web... dammit!

Anyway, a few posts to Adobe's forums and nuthin. However, Russell Brown gave me an idea by suggesting I download a new version of the "Image Processor" script. This is a Script that Photoshop uses to convert RAW images to JPG... and you guessed it, is written in JavaScript.

So, I cracked it open and hacked some code into line 1315. This code basically tells Adobe Bridge to go and copy the GPS info from the RAW file to the JPG.

if ( BridgeTalk.isRunning( "bridge" ) ) {
 var bt = new BridgeTalk();
 bt.target = "bridge";
 
 var script = "var rawThumbnail = new Thumbnail (File(\"" + inFileName + "\"));";
 script += "var newPicture = new Thumbnail (File(\"" + uniqueFileName + "\"));";
 script += "var rawMedadata = rawThumbnail.metadata;";
 script += "newPictureMetadata = newPicture.synchronousMetadata;";
 script += "rawMedadata.namespace = \"http://ns.adobe.com/exif/1.0/\";";
 script += "newPictureMetadata.namespace = \"http://ns.adobe.com/exif/1.0/\";";
 script += "newPictureMetadata.GPSLatitude = rawMedadata.GPSLatitude;";
 script += "newPictureMetadata.GPSLongitude = rawMedadata.GPSLongitude;";
 script += "newPictureMetadata.GPSAltitudeRef = rawMedadata.GPSAltitudeRef;";
 script += "newPictureMetadata.GPSAltitude = rawMedadata.GPSAltitude;";
 
 bt.body = script;
 bt.send();
 bt.pump();
}

You can find the Image Processor Script in %Program Files%\Adobe\Adobe Photoshop CS2\Presets\Scripts.

I filed a bug report with Adobe, but who knows if they will fix it...

"Thank you!

Please note: You will not get a response to your bug submission. "

Update: I find this amazing.. as it paints a clear picture for me that whomever tested this feature at Adobe had no idea what they were doing.

When you write out GPS tags using the scripting interface above, it only updates Adobe's internal cache, the data is not ever written to the file in the case of a DNG or to the XMP sidecar file in the case of a NEF or other raw format. As a result, the GPS data is then not copied to the JPEG with my modifications to the Image Processor script.

I guess I'm off to file another bug. Ugh. In the mean time I wrote a reliable mechanism to write the GPS data from JPEG to RAW using a good old command line application. No Adobe software required. This ensures that the GPS data is in fact copied back to the JPEG when you process the RAW file in Photoshop, Bridge or Lightroom.

Posted Friday, July 21, 2006    Permalink    Comments [4]  View blog reactions

 

Sunday, July 23, 2006 12:19:26 PM (Pacific Daylight Time, UTC-07:00)
Comment day for me. :)

Nice stuff. I'd like to get my hands on it! Heh. I have had the timezone problem, too (in other ways, not GPS related specifically). And since I travel a lot when I am takinbg pics, I am trying to decide how to best deal with it. I guess keep everything Pacific Time? How do you deal with it?
Thursday, October 19, 2006 8:39:16 AM (Pacific Daylight Time, UTC-07:00)
I'm struggling with the same issues. One workaround for the timezone issue is to change your PC timezone to your GPS track one before you run Location Stamper.

Do you mind sharing your command line application?

Thanks.
Max
Thursday, May 01, 2008 6:34:58 AM (Pacific Daylight Time, UTC-07:00)
Hi,

I just bought the ATP PhotoFinder that write GPS info into image file. Unfortunately, it works only with JPEG files.
I'm also searching an automatic tool (preferably for Mac OSX) to copy these data from the .JPG file to .RAW (or better .DNG) files.
Is your "command line application" available somewhere ?

Thanks a lot !
Friday, May 29, 2009 1:55:13 AM (Pacific Daylight Time, UTC-07:00)
Adobe PhotoShop has released a free online version Adobe PhotoShop Express - http://www.frogmix.com/search/Adobe+PhotoShop+Express . It is only available to the US as yet, which peeves me, so all I can tell you is that it is a cut down and simpler to use version of Photoshop.
dick
Comments are closed.