从相机照片元数据获取 GPS 数据

发布于 2024-12-02 07:18:55 字数 239 浏览 0 评论 0原文

在 UIImagePickerController 的帮助下,我为我的应用程序获取了一张照片。是否可以从委托获取地理数据:

 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info

这是信息字典,是否可以从中获取地理标签?

I get a photo for my app with help of UIImagePickerController. Is it possible to get Geo data from the delegate:

 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info

Here is info dictionary, is it possible to get Geo tags from it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

清秋悲枫 2024-12-09 07:18:55

使用 EXIF 库 http://code.google.com/p/iphone-exif/

代码

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {
    NSData* jpegData = UIImageJPEGRepresentation (image,0.5);
    EXFJpeg* jpegScanner = [[EXFJpeg alloc] init];
    [jpegScanner scanImageData: jpegData];
    EXFMetaData* exifData = jpegScanner.exifMetaData;
    EXFTag* latitudeDef = [exifData tagDefinition: [NSNumber numberWithInt:EXIF_GPSLatitude]];
    EXFTag* longitudeDef = [exifData tagDefinition: [NSNumber numberWithInt:EXIF_GPSLongitude]];
...}

SO问题: UIImagePickerController 和提取现有照片的 EXIF 数据

use EXIF library http://code.google.com/p/iphone-exif/

code

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {
    NSData* jpegData = UIImageJPEGRepresentation (image,0.5);
    EXFJpeg* jpegScanner = [[EXFJpeg alloc] init];
    [jpegScanner scanImageData: jpegData];
    EXFMetaData* exifData = jpegScanner.exifMetaData;
    EXFTag* latitudeDef = [exifData tagDefinition: [NSNumber numberWithInt:EXIF_GPSLatitude]];
    EXFTag* longitudeDef = [exifData tagDefinition: [NSNumber numberWithInt:EXIF_GPSLongitude]];
...}

SO question: UIImagePickerController and extracting EXIF data from existing photos

篱下浅笙歌 2024-12-09 07:18:55

在 iOS 5.1.1 之前,UIImagePickerController 不会将 GPS 位置数据添加到使用它拍摄的照片中。相机应用程序的位置服务设置是什么并不重要,它仅控制该应用程序而不是 UIImagePickerController。

您将需要使用 CLLocation 类来获取位置,然后将其添加到使用 UIImagePickerController 拍摄的任何图像和视频中。

Up to and including iOS 5.1.1, the UIImagePickerController does not add GPS location data to photos shot using it. It doesn't matter what the setting of location services for the Camera app is, that only controls that app not the UIImagePickerController.

You will need to use the CLLocation class to get the location and then add that to any images and videos shot with the UIImagePickerController.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文