Latest 1.3.0
Homepage https://github.com/xxxAIRINxxx/Cmg
License MIT
Platforms ios 9.0, requires ARC
Authors

Version
Swift 4.0
Platforms iOS
Xcode 9.1+

CmgImage

Easy image filtering library of using Core Image. (CIFilter)

Cmg is inspired by Filterpedia.

Requirements

  • Xcode 9.1+
OS Swift
v1.1.x iOS 8+ 3.0
v1.2.x iOS 9+ 3.2
v1.3.x iOS 9+ 4.0

Features

  • Image filtering (use CIFilter)
  • Filter grouping
  • Filter chaining
  • Slider support
  • Face detection (bonus)

Usage

Basics

Example for GaussianBlur filter

Default filter

let filteredImage = GaussianBlur().processing(image)

Edit for filter parameter

var filter = GaussianBlur()
filter.radius = 15.0
let filteredImage = filter.processing(image)

Edit for filter parameter (using closure)

let filteredImage = GaussianBlur()
      .configuration(){ filter in filter.inputRadius.setValue(15) }
      .processing(image)

Filter Group

let filterGroup = FilterGroup(name: "FilterGroupExample", [
    BoxBlur().configuration({ filter in filter.inputRadius.setValue(15) }),
    Vignette(),
    PhotoEffectMono(),
    ])

let filteredImage = filterGroup.processing(image)

Filter Chaining

let filteredImage = image.cmg_chain([
    ComicEffect(),
    GaussianBlur().configuration({ filter in
        filter.inputRadius.setValue(15)
    }),
    PerspectiveTile(imageSize: image.size).configuration({ filter in
        filter.inputTopLeft.setVector(Vector2(x: 118.0, y: 490.0).ciVector)
    }),
    ])

Demo

Please see Demo project. (Support Filter ShowCase)
Please try on iOS Devices.
Simulator is very slow…

Screenshot

Installation

CocoaPods

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

use_frameworks!

pod "Cmg"

Carthage

To integrate Cmg into your Xcode project using Carthage, specify it in your Cartfile:

github "xxxAIRINxxx/Cmg"

Use Image

Thanks pixabay

License

MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "Cmg",
    "version": "1.3.0",
    "summary": "Easy image filtering library of using Core Image.",
    "homepage": "https://github.com/xxxAIRINxxx/Cmg",
    "license": "MIT",
    "authors": {
        "Airin": "[email protected]"
    },
    "source": {
        "git": "https://github.com/xxxAIRINxxx/Cmg.git",
        "tag": "1.3.0"
    },
    "requires_arc": true,
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "Sources/*.swift",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This