Updating iOS UII memory in memory with EXIF ​​/ geotag information

I am trying to update a UIImage using a geotag. I looked at Saving geotagging information with photos on iOS4.1 , where I found a link to Category NSMutableDDictionary + ImageMetadata . However, I do not want to save to the photo album, but pass UIImage .

The following code looked like it was making too many copies of the image and required the binding of all these frameworks: CoreImage, AssetsLibrary, CoreMedia, ImageIO.

Is there something more efficient that UIImage CIImage CGImage UIImage - UIImage that can take the NSDictionary properties needed to set EXIF ​​data?

 - (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; } 
+4
source share
1 answer

Take a look at libexif: http://libexif.sourceforge.net/

You probably need to transfer the image byte data to the library using

 UIImageJPEGRepresentation(image, quality) bytes] 
0
source

Source: https://habr.com/ru/post/1393581/


All Articles