Latest 0.1.1
Homepage https://github.com/lucas1295santos/ImageCropperPOD
License MIT
Platforms ios 8.0
Frameworks UIKit
Authors

Crop and resize images without breaking a sweat!

Quick exemple:

import ImageCropperPOD
...
let cropper = ImageCropper()
let croppedImage = cropper.crop(image: originalImage, anchor: .center, percentualWidth: 0.5, percentualHeight: 0.5)
self.imageView.image = croppedImage

With the anchor property, you can easily archive any kind of cropping, like the image above:
alt text

Cropping

First

Create a ImageCropper object

let cropper = ImageCropper()

Second

Do the croping use the crop function, and passing the folloing parameters:
image: The UIImage that you want to crop.
anchor: The anchor to use when cropping. The five possible values are .topLeft / .topRight / .center / .bottonLeft / .bottonRight. Look at the image on the exemple to see the effect of choosing each anchor.
percentualWidth and percentualHeight A number between 0 and 1 that indicates the width or height for the cropped image in relation to the original one. So a percentualWidth of 1 will result in no cropping on the horizontal axis, and a percentualWidth of 0.5 will result in a image cropped in half on the horizontal axis.
So as exemple, a croping getting the topLeft quarter of a image (cropping in half on horizontal and vertical)

let croppedImage = cropper.crop(image: originalImage, anchor: .topLeft, percentualWidth: 0.5, percentualHeight: 0.5)

Latest podspec

{
    "name": "ImageCropperPOD",
    "platforms": {
        "ios": "8.0"
    },
    "version": "0.1.1",
    "summary": "A simple tool to crop images in swift",
    "description": "A simple tool to crop images in swift, i will think in something later, add a tutorial and so on",
    "homepage": "https://github.com/lucas1295santos/ImageCropperPOD",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Lucas Santos": "[email protected]"
    },
    "source": {
        "git": "https://github.com/lucas1295santos/ImageCropperPOD.git",
        "tag": "0.1.1"
    },
    "swift_version": "4.0",
    "source_files": "ImageCropperPOD/**/*.{swift}",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This