问题描述
我正在尝试使用ALAssetLibrary在Photos应用中获取图片,但是最近我发现了一个问题,当我从ALAssetRepresentation获得CGImageRef时,UIImageOrientation是错误的(旋转90度),但是当我从CGImageRef,他们错了,现在我该如何获取正确的CGImageRef或使用CGImageRef创建正确的UIImage?
I'm trying to ALAssetLibrary to fetch pictures in Photos app, but recently I found a problem, when I get the CGImageRef from ALAssetRepresentation, the UIImageOrientation is wrong(rotated 90 degree), but when I get width and height from the CGImageRef, they're wrong either, now how could I get the right CGImageRef or use the CGImageRef to create a right UIImage?
推荐答案
使用UIImage的imageWithCGImage:scale:orientation:方法。并为方向参数传入ALAsset的ALAssetPropertyOrientation属性。
Use the imageWithCGImage:scale:orientation: method of UIImage. And pass in the the ALAssetPropertyOrientation property of ALAsset for the orientation parameter.
这篇关于ALAssetRepresentation fullResolutionImage的UIImageOrientation错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!