CGImageSource对图像数据读取任务的抽象

来自:http://www.tanhao.me/pieces/1019.html/html

其中获取到的kCGImagePropertyPixelHeight和kCGImagePropertyPixelHeight的数值是原始的值,也就是旋转以前的数值,因此要获取到显示图像的宽和高,须要对应kCGImagePropertyOrientation的值,而经过查看kCGImagePropertyOrientation的文档介绍,值分别从1-8,但其解释却让人看不懂,通过测试,得出与UIImageOrientation有如下的映射关系:测试

UIImageOrientationUp: 1 正常方向(默认值) 如图:翻译

UIImageOrientationDown: 3 旋转180度(朝左朝右固然是同样的) 如图:htm

UIImageOrientationLeft: 8 向左逆时针旋转90度 如图:文档

UIImageOrientationRight: 6 向右顺时针旋转90度 如图:get

UIImageOrientationUpMirrored: 2 将原图水平的翻转到背面 如图:io

UIImageOrientationDownMirrored: 4 在水平翻转以后再旋转180度 如图:im

UIImageOrientationLeftMirrored: 5 在水平翻转以后向左逆时针旋转90度 如图:img

UIImageOrientationRightMirrored: 7 在水平翻译以后向右顺时针旋转90度 如图:tar

相关的Demo:头像裁剪选择器McAvatarView

相关文章
相关标签/搜索