0

我正在尝试调整 UIImage 的大小。我正在拍摄图像并将其宽度设置为 640(例如),并检查我必须使用的因子,并将其用于图像高度。

不知何故,图像有时会翻转,即使是纵向图像,它也会变成横向。我可能没有注意这里的东西..

  //scale 'newImage'
    CGRect screenRect = CGRectMake(0, 0, 640.0, newImage.size.height* (640/newImage.size.width) );
    UIGraphicsBeginImageContext(screenRect.size);
    [newImage drawInRect:screenRect];
    UIImage *scaled = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
4

1 回答 1

-1

好的,我有答案,但不是她。当我从assetLibrary 中获取图像时,我使用了它:

CGImageRef imageRef = result.defaultRepresentation.fullResolution;

这会翻转图像,现在我使用:

CGImageRef imageRef = result.defaultRepresentation.fullScreenImage;

图像很好。

于 2013-03-17T10:29:26.847 回答