SmartCropLib
SmartCropLib copied to clipboard
SmartCrop.framework is an efficient picture smart clipping library

SmartCrop.framework is an efficient picture smart clipping library
- Usage
- Prepare
- Code
- Demo
- Demo run
- Output result
- License
Usage
Prepare
- Drag and drop SmartCrop.framework from the SmartCrop folder into the project
- Add SmartCrop.framework to Embedded Binaries
- Add libc++.tbd to Linked Frameworks and Libraries
- Add opencv2.framework into the project (You can download opencv2.framework from here , it is recommended to use version 3.4.4.)
Code
If you want to get a smart cropped image
let image = UIImage(named:"demo.jpg")
let smartCropImage = SmartCropper.cropImage(image, size: CGSize(width: 1080, height:1920))
If you want to get smart clipping coordinates
let image = UIImage(named:"demo.jpg")
let smartCropRect = SmartCropper.cropRect(with:image, size: CGSize(width: 1080, height:1920))
Demo
Demo run
If you want to run SmartCropDemo, just follow the instructions above to download opencv2.framework and drag it to the SmartCrop folder (note the zip file).
Output result
Original image1

After smart crop

Original image2

After smart crop

Original image3

After smart crop

License
SmartCrop is released under the MIT license. See LICENSE for details.