简体   繁体   中英

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

I get asset using 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.

To load fullScreen or fullResolution image and compare its width and height is to heavy .

To load metadata and than pixelHeight and Width is also heavy.

So can someone help?

You can use the orientation method of ALAssetRepresentation (available since iOS 4.0). So your call would be something like this.

ALAssetOrientation orientation = [[asset defaultRepresentation] orientation];

The performance of this call should be fine.

Cheers,

Hendrik

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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