Skip to content
A Swift implementation of fastimage. Supports PNG, GIF, and JPEG.
Swift Ruby Makefile
Branch: master
Clone or download

Latest commit

Latest commit bf08266 Nov 30, 2019


Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows Remove mac tests Nov 30, 2019
Demo Add SwiftPM support Aug 31, 2019
ImageScout.xcodeproj Rename mac target Sep 1, 2019
ImageScout.xcworkspace Add SwiftPM support Aug 31, 2019
Sources/ImageScout Add SwiftPM support Aug 31, 2019
Tests Add SwiftPM support Aug 31, 2019
.gitignore Remove swiftpm files Nov 30, 2019
.swift-version Update .swift-version Aug 31, 2019
ImageScout.podspec Add SwiftPM support Aug 31, 2019
Info.plist Add SwiftPM support Aug 31, 2019
LICENSE Initial commit Oct 11, 2014
Logo.png Update README Jan 21, 2018
Makefile Update Makefile Nov 30, 2019
Package.swift Add SwiftPM support Aug 31, 2019 Add SPM instructions Nov 30, 2019



Test GitHub release Swift 5.0 platforms

ImageScout is a Swift implementation of fastimage. It allows you to find the size and type of a remote image by downloading as little as possible.


Sometimes you need to know the size of a remote image before downloading it, such as using a custom layout in a UICollectionView.


ImageScout parses the image data as it is downloaded. As soon as it finds out the size and type of image, it stops the download. The downloaded data is below 60 KB in most cases.


Swift Package Manager

Add the following to your Package.switft file:

let package = Package(
    dependencies: [
    .package(url: "", from: "2.1.0")


  • Add the following to your Cartfile: github "kaishin/ImageScout"
  • Then run carthage update
  • Follow the current instructions in Carthage's README for up to date installation instructions.


  • Add the following to your Podfile: pod 'ImageScout'
  • You will also need to make sure you're opting into using frameworks: use_frameworks!
  • Then run pod install with CocoaPods 1.0 or newer.


The only method you will be using is scoutImageWithURI(), with the following full signature:

func scoutImageWithURI(URI: String, completion: (NSError?, CGSize, ScoutedImageType) -> ())

Here's an example:

let scout = ImageScout()

scout.scoutImageWithURI("http://.../image-scout-logo.png") { error, size, type in
  if let error = error {
  } else {
    print("Size: \(size)")
    print("Type: \(type.rawValue)")

If the image is not successfully parsed, the size is going to be CGSizeZero and the type .Unsupported. The error will contain more info about the reason:

  • Error code 100: Invalid URI parameter.
  • Error code 101: Image is corrupt or malformatted.
  • Error code 102: Not an image or unsopported image format URL.

⚠️ It's important to keep a strong reference to the ImageScout instance until the callback completes. If reference is lost, your completion handler will never be executed.


  • Swift 5 / Xcode 11
  • iOS 8+
  • macOS 10.11



You can’t perform that action at this time.