2014年4月23日水曜日

UIImageの向き情報の破棄

UIImageから画像を取得しようとすると左向きに画像が倒れてしまっていた。
(普通の縦向きでカメラから取得した画像。)

ので、再描画して画像の向きをなくした状態に戻した。
こういうのが難しいよなあ。。。

        UIImage *image; 

        UIGraphicsBeginImageContext(_imageView.image.size);
        [_imageView.image drawAtPoint:CGPointMake(0, 0)];
        image = UIGraphicsGetImageFromCurrentImageContext();


最初は画像を回転させてなんとかしようと思ったが回転できなかった。
ナンデ!?
参考記事を見るに一般的な解決法な気がするが。

        UIImage *image; 
        image = [UIImage imageWithCGImage:_imageView.image.CGImage
                                    scale:1.0
                              orientation:UIImageOrientationRight];

0 件のコメント:

コメントを投稿