Skip to content

martinpilch/MMMFilterKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MMMFilterKit

Version License Platform

MMMFilterKit simplify usage of CIFilter to just few lines of code. You can simply chain them, create your own and perform them on EAGLContext.

Example

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

Installation

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

pod 'MMMFilterKit'

Note that you'll also need to add use_frameworks! to your Podfile if you haven't already.

Author

Martin Pilch, martin.pilch@email.cz

License

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

Usage

You can simply get processed image by passing CIImage to any of built-in filters.

let outImg = SharpenFilters.SharpenLuminance(0.5)(inImg)

Chaining

Filters can be chained together using the |> operator.

let randomFilter = GeneratorFilters.RandomGenerator()
let contrastFilter = ColorAdjustmentFilters.ColorControls(saturation: 0, brightness: 0, contrast: 1)
let colorFilter = ColorAdjustmentFilters.ColorMatrix(red: 0.2, green: 0.2, blue: 0.2, alpha: 0.5)
let filters = randomFilter |> contrastFilter |> colorFilter
let outImg = filters(inImg)

Processing using EAGLContext

If you need to execute filters fast, you can use ImageProcessing class to do it using EAGLContext.

let filterExposure = ColorAdjustmentFilters.ExposureAdjust(exposure: exposure)
let filterSharpen = SharpenFilters.SharpenLuminance(sharpness: sharpen)

let filters: [Filter] = [filterExposure, filterSharpen]
ImageProcessing.sharedInstance.processImage(image: image, filters: filters) { [weak self] (outputImage) in
    self?.imageView?.image = outputImage
}

Thanks

Inspired by the "CIFilterKit" by Jeff Blagdon.

About

MMMFilterKit simplify usage of CIFilter to just few lines of code. You can simply chain them, create your own and perform them on EAGLContext.

Resources

License

Stars

Watchers

Forks

Packages

No packages published