Easy image filtering library of using Core Image. (CIFilter)
Cmg is inspired by Filterpedia.
- Xcode 10+
OS | Swift | |
---|---|---|
v1.1.x | iOS 8+ | 3.0 |
v1.2.x | iOS 9+ | 3.2 |
v1.3.x | iOS 9+ | 4.1 |
v1.4.x | iOS 9+ | 4.2 |
v1.5.x | iOS 10+ | 5.0 |
- Image filtering (use CIFilter)
- Filter grouping
- Filter chaining
- Slider support
- Face detection (bonus)
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)
let filterGroup = FilterGroup(name: "FilterGroupExample", [
BoxBlur().configuration({ filter in filter.inputRadius.setValue(15) }),
Vignette(),
PhotoEffectMono(),
])
let filteredImage = filterGroup.processing(image)
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)
}),
])
Please see Demo project. (Support Filter ShowCase) Please try on iOS Devices. Simulator is very slow...
Cmg is available through CocoaPods. To install it, simply add the following line to your Podfile:
use_frameworks!
pod "Cmg"
To integrate Cmg into your Xcode project using Carthage, specify it in your Cartfile:
github "xxxAIRINxxx/Cmg"
Thanks pixabay
MIT license. See the LICENSE file for more info.