在 Aperture 中检索图像的正确时间戳
Aperture 和 Cocoa 开发人员有一个问题……
我使用 Aperture 和 @Fraser Speirs 的 FlickrExport 插件来管理我的照片并将其上传到 Flickr。 FlickrExport 使用 Flickr 照片 ID(以及其他内容)在 Aperture 中设置自定义标签,以便您可以查看哪些图像已导出。我还通过电子邮件将 iPhone 上的照片直接发布到 Flickr(这是我发现保持 EXIF 数据完整的唯一方法)。
我正在尝试编写一个 Python 脚本,该脚本将轮询我的 Flickr 流并识别两个空间中都存在但没有 Aperture 自定义标签(表明照片也已上传到 Flickr)的图像。在我升级到 Lion 之前,它通常运行良好,但现在我发现了一些漏洞。
Flickr 和 Aperture 的时区处理很糟糕/不存在,并且 EXIF 时间戳不捕获时区。该图像的时间戳仅显示“7 月 14 日上午 10:03”。如果当我将图像导入 Aperture 时,我的计算机系统时区设置为波士顿(美国/东部),Aperture 会将其显示为 7/14/11 10:03:00 AM EDT
。如果我再次导入相同的图像,但将系统时区设置为洛杉矶(美国/太平洋地区),则图像的日期显示为 7/14/11 10:03:00 AM PDT
。好吧,这是令人困惑和错误的(如果没有表示时区,则不应暗示)。
现在让我们切换域。我正在使用 ScriptingBridge 通过 Python 与 Aperture 交互。当我检索 ImageDate EXIF 标记的值时返回的 NSDate 被更正为当前系统时区(在我的例子中为美国/东部)。
对于当我的系统时区设置为美国/东部时导入的图像:
>>> aperture = ScriptingBridge.SBApplication.applicationWithBundleIdentifier_("com.apple.Aperture")
>>> aperture.selection()[0].EXIFTags().objectWithName_("ImageDate").value().get()
2011-07-14 10:43:37 −0400
对于当我的系统时区设置为美国/太平洋时导入的图像:
>>> aperture.selection()[0].EXIFTags().objectWithName_("ImageDate").value().get()
2011-07-14 13:43:37 −0400
因此 Aperture 似乎认为它知道图像的时区是什么(即使没有提供),但似乎没有办法通过 ScriptingBridge 返回它。那么,给定这个 NSDate 对象,有什么方法可以找到原始时区的日期和时间,即使我不知道原始时区是什么?这可以通过 Aperture 插件 API 实现吗?
请注意,如果我使用“批量更改”命令执行时间调整并设置时区,或者通过导入窗格进行相同的调整,则会添加两个自定义标签:pictureTimeZoneName
和 cameraTimeZoneName< /代码>。如果
pictureTimeZoneName
存在,我应该能够提取时间戳而不需要任何“更正”。但我正在寻找一种不需要太多用户干预的解决方案。
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 sets 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论