Latest 1.0.0
Homepage https://github.com/kiroru/KRImageTrimmer
License MIT
Platforms ios 9.0
Frameworks UIKit, CoreGraphics
Authors

KRImageTrimmer for iOS

Version
License
Platform
Carthage compatible

KRImageTrimmer provides a screen to cut the image to be edited into a square.

Screenshots

Example

This is a sample to get an image from a camera or photo library and crop it with this library.
You can execute the sample in the following command.

Run try pod to open the sample project.

$ pod try KRImageTrimmer

Installation

CocoaPods

To install, add the following line to Podfile.

target `MyProject` do
    use_frameworks!
    pod 'KRImageTrimmer'
end

Carthage

To install, add the following line to Cartfile.

git "https://github.com/kiroru/KRImageTrimmer.git"

After building the framework by running carthage update,
linkKRImageTrimmer.framework to the project and import it with import KRImageTrimmer.

Basic Usage

Show KRImageTrimmer

func show() {
    // various settings
    let options = KRImageTrimmerController.Options()
    options.cancelButtonTitle = "Back"

    // Create screen instances
    let vc = KRImageTrimmerController(options: options)

    // Set a delegate
    vc.delegate = self

    // Display KRImageTrimmer
    navigationController?.pushViewController(vc, animated: true)
}

Implement delegate processing

/// Pass the image to be edited
func imageForTrimming() -> UIImage {
    return UIImage(named: "sample")
}

/// Called when image editing is canceled
func imageTrimmerControllerDidCancel(_ imageTrimmer: KRImageTrimmerController) {
    navigationController?.popViewController(animated: true)
}

/// When image editing is completed, the image after editing will be returned
func imageTrimmerController(_ imageTrimmer: KRImageTrimmerController, didFinishTrimmingImage image: UIImage?) {
    navigationController?.popViewController(animated: true)
    imageView.image = image
}

License

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

Latest podspec

{
    "name": "KRImageTrimmer",
    "version": "1.0.0",
    "summary": "Simple screen to crop the image to a square.",
    "description": "Simple screen to crop the image to a square. You can enlarge, reduce and move.",
    "homepage": "https://github.com/kiroru/KRImageTrimmer",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "takeguchi": "[email protected]"
    },
    "source": {
        "git": "https://github.com/kiroru/KRImageTrimmer.git",
        "tag": "1.0.0"
    },
    "swift_version": "4.2",
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "KRImageTrimmer/Classes/**/*.swift",
    "resource_bundles": {
        "KRImageTrimmer": [
            "KRImageTrimmer/Assets/**/*.xib"
        ]
    },
    "frameworks": [
        "UIKit",
        "CoreGraphics"
    ]
}

Pin It on Pinterest

Share This