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