image尺寸改变后保留Exif数据

使用UIImage和resize.m获取图片,进行尺寸重置。但是还想保留图片的Exif数据,所以我希望写如下:

CGImageDestinationAddImageFromSource(destination, resized, 0, imagePropertiesDictionary);

获取了exif数据,但是图片根据图片的原始方向进行旋转了。有没有获取数据但是还能让图片修改尺寸的方法?

你可以写一个方向属性来覆盖前一个:

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

注意保证imagePropertiesDictionary是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