FaceCropImageView 1.1.1

FaceCropImageView 1.1.1

Maintained by HanSJin.

  • By
  • hansjin

Awesome License Platform

Face Crop ImageView

This FaceCropImageView is the extension of UIImageView that helps to crop and show the proper location of face in the photo. This library was strongly inspired by UIImageView-BetterFace.

Demo screenshot and description are here!


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

pod 'FaceCropImageView'

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


Simple usage likes below.

let myImage = UIImage(named: "some-image")

You can also crop the image of the web through the image URL. (In this case, the Kingfisher library is used)

let imageUrl = URL(string: "https://some-url/image.jpg")
imageView.setFaceImage(with: imageUrl)

If you need to detect faces more specifically, use fast parameter. This parameter can determine the value of CIDectorAccuracy to CIDectorAccuracyLow or CIDectorAccuracyHigh.

imageView.setFaceImage(with: imageUrl, fast: false)

And it supports the completion closure.

imageView.setFaceImage(with: imageUrl, fast: false) { result in
    switch result {
    case .success(let features):
        // `feature` means detected face infomation.
        // `features.count == 0` means no face in the image.
    case .failure(let error):


HanSJin, [email protected]


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