2
我已经看了很多问题在这里在Stackoverflow和他们都没有解决我的问题。图片90度旋转AVCam
所以,我使用的是苹果的AVCam样本: http://developer.apple.com/library/ios/#samplecode/AVCam/Introduction/Intro.html
所以,当我拍张照片,并将其保存在图片库中它的罚款,但是当我表现出来的画面通过裁剪它,当我发送它到服务器通过使用
NSData* pictureData = UIImageJPEGRepresentation(self.snappedPictureView.image, 0.9);
它发送90度旋转!
这里是我的代码裁剪:
UIImage* cropped = [image imageByCroppingRect:CGRectMake(0, 0, (image.size.width * 300)/self.view.frame.size.width, (image.size.height * 300)/self.view.frame.size.height)];
imageByCroppingRect is:
- (UIImage *) imageByCroppingRect:(CGRect)area
{
UIImage *croppedImage;
CGImageRef imageRef = CGImageCreateWithImageInRect([self CGImage], area);
// or use the UIImage wherever you like
croppedImage = [UIImage imageWithCGImage:imageRef];
CGImageRelease(imageRef);
return croppedImage;
}
http://stackoverflow.com/questions/5427656/ios-uiimagepickercontroller-result-image-orientation-after-upload外观向我承诺。 –
该链接的解决方案有效,但它会导致您再次渲染整个图像,这需要一段时间,尤其是从摄像机滚动的大图像。请参阅我的回答。 – brynbodayle