2012-01-29 2 views
4

UIImage 위치 정보를 업데이트하려고합니다. 나는 Saving Geotag info with photo on iOS4.1을 보았는데, 이것은 NSMutableDDictionary+ImageMetadata category에 대한 참조를 발견 한 곳입니다. 그러나 사진 앨범에 저장하고 싶지는 않지만 UIImage을 전달해야합니다.EXIF ​​/ 위치 정보 태그로 메모리 내 iOS UII 이미지 업데이트

다음 코드는 이미지 사본이 너무 많아서 CoreImage, AssetsLibrary, CoreMedia, ImageIO와 같은 모든 프레임 워크가 연결되어있는 것 같습니다.

는보다 효율적인 뭔가가 있나요 UIImage -> CIImage -> CGImage -> NSDictionary와는 EXIF ​​데이터를 설정에 필요한 속성을 취할 수 UIImage? 당신은 아마

UIImageJPEGRepresentation(image, quality) bytes] 
을 사용하여 라이브러리에 이미지의 바이트 데이터를 전달해야합니다 http://libexif.sourceforge.net/

:

- (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; 
} 

답변

0

는 libexif에서보세요
관련 문제