سؤال

Using "UIImage+Resize.m" getting image in proper orientation when resizing. But i won't want to lose Image Exif data. So tried to write Exif data again like

CGImageDestinationAddImageFromSource(destination, resized, 0, imagePropertiesDictionary);

Now i got exif data but image get rotated based on Image's orientation property in Exif data. Is there any way get proper image resized image without losing Exif data?

هل كانت مفيدة؟

المحلول 2

you can write the orientation property to cover the original one

[imagePropertiesDictionary setObject:[NSNumber numberWithInt:orientation] forKey:@"Orientation"];

but make sure imagePropertiesDictionary is NSMutableDictionary

//        case UIDeviceOrientationLandscapeLeft: return 1; // Top, left
//        case UIDeviceOrientationPortrait: return 6; // Right, top
//        case UIDeviceOrientationLandscapeRight: return 3; // Bottom, right
//        case UIDeviceOrientationPortraitUpsideDown: return 8; // Left, bottom

نصائح أخرى

it certainly depend on how you are resizing the image that exif is maintained or not. In most of the cases resizing and saving it back in iPhone causes loss of Exif info. A possible solution would be to fetch the exif data then resize the image. then rewrite exif back.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top