简体   繁体   English

使用ALAssetLibrary快速了解图像资源是横向还是纵向?

[英]Quick way to know if the image asset is landscape or portrait using ALAssetLibrary?

I get asset using ALAssetLibrary. 我使用ALAssetLibrary获得资产。 Is there way to know is this image landscape or portrait not loading the image but having only asset? 有没有办法知道这个图像风景或肖像没有加载图像,但只有资产?

[asset thumbnail ] returns (75,75) size image,so its doesn't help. [资产缩略图 ]返回(75,75)大小的图像,所以它没有帮助。

To load fullScreen or fullResolution image and compare its width and height is to heavy . 要加载fullScreenfullResolution图像并比较它的宽度和高度是重的

To load metadata and than pixelHeight and Width is also heavy. 加载元数据pixelHeightWidth也重。

So can someone help? 有人可以帮忙吗?

You can use the orientation method of ALAssetRepresentation (available since iOS 4.0). 您可以使用ALAssetRepresentation的方向方法(自iOS 4.0起可用)。 So your call would be something like this. 所以你的电话会是这样的。

ALAssetOrientation orientation = [[asset defaultRepresentation] orientation]; ALAssetOrientation orientation = [[asset defaultRepresentation] orientation];

The performance of this call should be fine. 这个电话的表现应该没问题。

Cheers, 干杯,

Hendrik 亨德里克

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM