Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/116.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用EXIF/geotag信息更新内存中的iOS UIImage_Ios_Image_Uiimage_Exif - Fatal编程技术网

使用EXIF/geotag信息更新内存中的iOS UIImage

使用EXIF/geotag信息更新内存中的iOS UIImage,ios,image,uiimage,exif,Ios,Image,Uiimage,Exif,我正在尝试使用地理标记信息更新UIImage。我看了一下,在那里我找到了对。但是,我不想保存到相册,而是要传递一个UIImage 下面的代码似乎制作了太多的映像副本,需要链接所有这些框架:CoreImage、AssetLibrary、CoreMedia、ImageIO 是否有比UIImage->CIImage->CGImage->UIImage更有效的方法可以获取设置EXIF数据所需的属性 - (UIImage *)updateImage:(UIImage *)image location:(C

我正在尝试使用地理标记信息更新
UIImage
。我看了一下,在那里我找到了对。但是,我不想保存到相册,而是要传递一个
UIImage

下面的代码似乎制作了太多的映像副本,需要链接所有这些框架:CoreImage、AssetLibrary、CoreMedia、ImageIO

是否有比
UIImage
->
CIImage
->
CGImage
->
UIImage
更有效的方法可以获取设置EXIF数据所需的属性

- (UIImage *)updateImage:(UIImage *)image location:(CLLocation *)location dateOriginal:(NSDate *)dateOriginal
{
    NSMutableDictionary *properties = [NSMutableDictionary dictionaryWithDictionary:[image.CIImage properties]];

    // uses https://github.com/gpambrozio/GusUtils   
    [properties setLocation:location];
    [properties setDateOriginal:dateOriginal];

    CIImage *tempImage = [[CIImage alloc] initWithImage:image options:properties];
    CIContext *context = [CIContext contextWithOptions:nil];    
    UIImage *updatedImage = [UIImage imageWithCGImage:[context createCGImage:tempImage fromRect:tempImage.extent]];

    return updatedImage;
}
看看libexif:

您可能需要使用

UIImageJPEGRepresentation(image, quality) bytes]