a library for iOS that allows you to retrieve the size of a remote image without having to download it.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example
Pod
.gitignore
.travis.yml
IMRemoteImageSize.podspec
LICENSE
README.md
_Pods.xcodeproj

README.md

IMRemoteImageSize

CI Status Version License Platform

IMRemoteImageSize is a simple library for iOS that allows you to retrieve the dimensions of a remote image (JPG, GIF, PNG or BMP), without having to download the image. It retrieves the first few bytes of the file and then stops downloading.

Usage

IMRemoteImageSize runs as an extension of UIImage. To retrieve the size of a remote image, all you have to do is the following:

At the top of your Swift file, add import IMRemoteImageSize, then add this code to get the size of an image:

let url = NSURL(...) // image url
UIImage.getImageSize(url, completion: { (size) -> Void in
    print("Got size of image: \(url): \(size)")
})

If the size was unable to be determined by the library, it will return CGSizeZero.

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Written in Swift 2.0, so it requires at least Xcode 7. Compatible with iOS 8.3 and above.

Installation

IMRemoteImageSize is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "IMRemoteImageSize"

Author

Ian McDowell, mcdow.ian@gmail.com

License

IMRemoteImageSize is available under the MIT license. See the LICENSE file for more info.