我们如何从UIImagePickerController中选择UIImage获取Exif信息?
我为此做了很多研发并获得了很多回复,但仍未能实现这一点.
请帮我解决这个问题.
提前致谢..
最奇怪的事情正在发生.我有一个操作表,让用户可以选择用相机拍照或从相机胶卷中选择一个.在UIImagePicker从选择返回后,我使用ALAssetsLibrary来确定嵌入在照片中的GPS信息.从相机胶卷中选择照片效果很好,我可以检索GPS信息.但是,用相机拍照绝对没有提供GPS信息,实际上我根本没有元数据.有谁知道我在这里做错了什么?
代码如下:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
if([mediaType isEqualToString:(__bridge NSString *)kUTTypeImage])
{
void (^ALAssetsLibraryAssetForURLResultBlock)(ALAsset *) = ^(ALAsset *asset)
{
// get images metadata
NSDictionary *metadata = asset.defaultRepresentation.metadata;
NSLog(@"Image Meta Data: %@",metadata);
// get coords
CLLocation *location = [asset valueForProperty:ALAssetPropertyLocation];
NSLog(@"coordLat: %f , coordLon: %f", location.coordinate.latitude, location.coordinate.longitude);
// do more here - rest of code snipped to keep this question short
};
NSURL *assetURL = [info objectForKey:UIImagePickerControllerReferenceURL];
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library assetForURL:assetURL …Run Code Online (Sandbox Code Playgroud) iphone gps objective-c uiimagepickercontroller alassetslibrary
我正在尝试用 Swift 编写一个 iOS 应用程序,让用户拍照,然后我将在图像上叠加一些额外的数据。我希望图像包含位置数据。我正在使用 AVCapturePhoto,我可以在文档中看到它有一些元数据变量,但我找不到有关如何使用它们的任何信息。当我现在用我的应用拍照时,它的 EXIF 信息中没有位置数据。
如何设置捕获会话以嵌入位置数据?