Logo

0x5a.live

for different kinds of informations and explorations.

GitHub - ZaidPathan/ZImageCropper: A Swift 5 repo to crop image in any shape.

A Swift 5 repo to crop image in any shape. Contribute to ZaidPathan/ZImageCropper development by creating an account on GitHub.

Visit SiteGitHub - ZaidPathan/ZImageCropper: A Swift 5 repo to crop image in any shape.

GitHub - ZaidPathan/ZImageCropper: A Swift 5 repo to crop image in any shape.

A Swift 5 repo to crop image in any shape. Contribute to ZaidPathan/ZImageCropper development by creating an account on GitHub.

Powered by 0x5a.live 💗

ZImageCropper

CI Status Version License Platform

ZImageCropper is a simplest way to crop image to any shapes you like.

alt ZImageCropper

Example

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

Requirements

Installation

Cocoapods

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

pod 'ZImageCropper'

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into Xcode and the Swift compiler.

If you are using Xcode 11 or later:

  1. Click File
  2. Swift Packages
  3. Add Package Dependency...
  4. Specify the git URL for ZImageCropper.
https://github.com/ZaidPathan/ZImageCropper

Manual

Add ZImageCropper.swift and ZImageCropperView.swift files to your project.

Usage

Crop using AI (Or programmatically)

Crop image using following code,

let croppedImage = ZImageCropper.cropImage(ofImageView: yourImageView, withinPoints: [
CGPoint(x: 0, y: 0),   //Start point
CGPoint(x: 100, y: 0),
CGPoint(x: 100, y: 100),
CGPoint(x: 0, y: 100)  //End point
])

Note : Make sure you provide valid points, points must be >=2 in count.

Crop using user touches,

Step 1: Add UIImageView to your StoryBoard/XIB and give it a Class Name: ZImageCropperView

Step 2: Run the app and see cropping is enable to your UIImageView

Step 3: Add @IBOutlet of your UIImageView and call method imageView.cropImage() to crop selected layer by user.

Author

Zaid Pathan

Contributor

Zaid Pathan, Devansh Vyas

License

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

Swift Resources

are all listed below.

Resources

listed to get explored on!!

Made with ❤️

to provide different kinds of informations and resources.