有以下幾個(gè)問(wèn)題:
1风秤、從手機(jī)系統(tǒng)相機(jī)豎向拍照鳖目,再在APP中選擇照片發(fā)送出去會(huì)有旋轉(zhuǎn)問(wèn)題;
2缤弦、從手機(jī)系統(tǒng)相機(jī)橫向拍照领迈,再在APP中選擇照片發(fā)送出去沒問(wèn)題;
3、在相冊(cè)中對(duì)照片編輯操作再發(fā)送也沒有問(wèn)題狸捅。
4衷蜓、我們用的TZImagePickerController選擇照片和視頻,里面第三方庫(kù)已經(jīng)處理這個(gè)旋轉(zhuǎn)90度問(wèn)題薪贫,為什么還有問(wèn)題恍箭?
解決如下:
// 解決圖片偏轉(zhuǎn)90度的問(wèn)題
UIImage *image = [UIImage imageWithData: imageData];
if(image.imageOrientation != UIImageOrientationUp) {
UIGraphicsBeginImageContext(image.size);
[image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)];
image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
data = UIImagePNGRepresentation(image);
}