KRImageTrimmer 1.0.0

KRImageTrimmer 1.0.0

Maintained by ktakeguchi.

  • By
  • takeguchi

KRImageTrimmer for iOS

Version License Platform Carthage compatible

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



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



To install, add the following line to Podfile.

target `MyProject` do
    pod 'KRImageTrimmer'


To install, add the following line to Cartfile.

git ""

After building the framework by running carthage update,
link KRImageTrimmer.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


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