开发者

Retrieving correct timestamp for image in Aperture

开发者 https://www.devze.com 2023-03-23 02:05 出处:网络
A question for the Aperture and Cocoa developers out there… I use Aperture and @Fraser Speirs\' FlickrExport plugin to manage my photos and upload them to Flickr.FlickrExport s开发者_JS百科ets custo

A question for the Aperture and Cocoa developers out there…

I use Aperture and @Fraser Speirs' FlickrExport plugin to manage my photos and upload them to Flickr. FlickrExport s开发者_JS百科ets custom tags in Aperture with the Flickr photo ID (among other things), so that you can see which images have been exported. I also post photos directly to Flickr from my iPhone via email (the only way I've found to keep the EXIF data intact).

I'm trying to whip up a Python script that will poll my Flickr stream and identify images which exist in both spaces but which do not have the Aperture custom tags that indicate that the photo was also uploaded to Flickr. It was generally working well until I upgraded to Lion, and now I'm finding some holes.

Flickr and Aperture have horrible/nonexistent time-zone handling, and the EXIF timestamps don't capture the timezone. The image's timestamp just says "July 14th at 10:03am". If my computer's system time zone is set to Boston (US/Eastern) when I import the image into Aperture, Aperture will display it as 7/14/11 10:03:00 AM EDT. If I import the very same image again but have my system time zone set to Los Angeles (US/Pacific), the image's date shows as 7/14/11 10:03:00 AM PDT. Ok, that's confusing and wrong (if no timezone is expressed, none should be implied).

Now let's switch domains. I'm using ScriptingBridge to interact with Aperture via Python. The NSDate returned when I retrieve the value for the ImageDate EXIF tag is corrected to the current system timezone (US/Eastern, in my case).

For the image imported when my system timezone was set to US/Eastern:

>>> aperture = ScriptingBridge.SBApplication.applicationWithBundleIdentifier_("com.apple.Aperture")
>>> aperture.selection()[0].EXIFTags().objectWithName_("ImageDate").value().get()
2011-07-14 10:43:37 −0400

For the image imported when my system timezone was set to US/Pacific:

>>> aperture.selection()[0].EXIFTags().objectWithName_("ImageDate").value().get()
2011-07-14 13:43:37 −0400

So Aperture seems to think it knows what the image's timezone is (even if none's been provided), but there doesn't appear to be a way to return that via ScriptingBridge. So, given this NSDate object, is there any way I can find the date and time in their original timezone, even though I don't know what that original timezone is? Is this possible instead via the Aperture plugin API?

Note that if I use the Batch Change command to perform a time adjustment and set the time zone, or make the same adjustment via the import pane, two custom tags are added: pictureTimeZoneName and cameraTimeZoneName. If pictureTimeZoneName exists, I should be able to extract the timestamp without any "corrections". But I'm looking for a solution that doesn't require as much user intervention.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号