Latest 1.1.1
Homepage https://github.com/hansjin/FaceCropImageView
License MIT
Platforms ios 10.0
Dependencies Kingfisher
Authors

Awesome
License
Platform

Face Crop ImageView

This FaceCropImageView is an extension of UIImageView, which helps properly crop and show the position of the face in the picture. This library is strongly inspired by UIImageView-BetterFace.

Demo screenshot and description are here!

Installation

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.

Usage

Simple instruction is explained as follows.

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

You can also crop the image on the web using the 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 from CIDectorAccuracyLow to 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.
        print(features)
    case .failure(let error):
        print(error)
    }
}

Author

HanSJin, [email protected]

License

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

Latest podspec

{
    "name": "FaceCropImageView",
    "version": "1.1.1",
    "summary": "Crop and show the proper location of face in the photo.",
    "description": "This FaceCropImageView is the extension of UIImageView that helps to crop and show the proper location of face in the photo.",
    "homepage": "https://github.com/hansjin/FaceCropImageView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "hansjin": "[email protected]"
    },
    "source": {
        "git": "https://github.com/hansjin/FaceCropImageView.git",
        "tag": "1.1.1"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source_files": "FaceCropImageView/Classes/**/*",
    "dependencies": {
        "Kingfisher": []
    }
}

Pin It on Pinterest

Share This