【问题标题】:Image Resizing without losing Exif Data?在不丢失 Exif 数据的情况下调整图像大小?
【发布时间】:2013-06-27 07:26:03
【问题描述】:

调整大小时使用“UIImage+Resize.m”获取正确方向的图像。但我不想丢失 Image Exif 数据。于是尝试再次像

那样写Exif数据
CGImageDestinationAddImageFromSource(destination, resized, 0, imagePropertiesDictionary);

现在我得到了 exif 数据,但图像会根据 Exif 数据中图像的方向属性进行旋转。 有什么方法可以在不丢失 Exif 数据的情况下获得适当的图像调整大小的图像?

【问题讨论】:

    标签: iphone uiimage image-resizing uiimageorientation


    【解决方案1】:

    这当然取决于您如何调整 exif 维护的图像大小。在大多数情况下,调整大小并将其保存回 iPhone 会导致 Exif 信息丢失。 一种可能的解决方案是获取 exif 数据,然后调整图像大小。然后重写exif。

    【讨论】:

      【解决方案2】:

      你可以写一个方向属性来覆盖原来的那个

      [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
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2010-09-28
        • 2016-08-10
        • 2018-05-20
        • 2010-11-16
        • 2013-01-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多