Objective c 调整uiimage的大小就是翻转它?
我正在尝试调整UIImage的大小。我正在拍摄图像,并将其宽度设置为640(例如),检查我必须使用的系数,并将其用于图像高度 不知何故,图像有时会翻转,即使是肖像图像,也会变成风景。 我可能没有注意这里的一些事情Objective c 调整uiimage的大小就是翻转它?,objective-c,Objective C,我正在尝试调整UIImage的大小。我正在拍摄图像,并将其宽度设置为640(例如),检查我必须使用的系数,并将其用于图像高度 不知何故,图像有时会翻转,即使是肖像图像,也会变成风景。 我可能没有注意这里的一些事情 //scale 'newImage' CGRect screenRect = CGRectMake(0, 0, 640.0, newImage.size.height* (640/newImage.size.width) ); UIGraphicsBeginImag
//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();
好的,我有答案,但不是她。 当我从assetLibrary中拍摄图像时,我随身携带了:
CGImageRef imageRef = result.defaultRepresentation.fullResolution;
这将翻转图像,现在我使用:
CGImageRef imageRef = result.defaultRepresentation.fullScreenImage;
图像很好。注意图像。方向,可能需要转置。