ImageFX
Powered by Metal through PixelKit
Install
Swift Package
.package(url: "https://github.com/hexagons/ImageFX.git", from: "0.1.4")Important when using the Swift Package, link the metal library by calling fxMetalLib(url:), before using any effects:
#if os(iOS)
fxMetalLib(url: Bundle.main.url(forResource: "PixelKitShaders-iOS", withExtension: "metallib")!)
#elseif os(macOS)
fxMetalLib(url: URL(fileURLWithPath: "/path/to/PixelKitShaders-macOS.metallib"))
#endifYou can find the latest Metal library from PixelKit here.
Cocoapods
pod 'ImageFX', '~> 0.1.4'Effects
Source image
Blur
let fxImage: UIImage = image.fxBlur(0.1)Edge
let fxImage: UIImage = image.fxEdge()Clamp
let fxImage: UIImage = image.fxClamp(low: 0.25, high: 0.75)Kaleidoscope
let fxImage: UIImage = image.fxKaleidoscope()Levels: Brightness
let fxImage: UIImage = image.fxBrightness(2.0)Levels: Gamma
let fxImage: UIImage = image.fxGamma(0.5)Levels: Invert
let fxImage: UIImage = image.fxInvert()Levels: Opacity
let fxImage: UIImage = image.fxOpacity(0.5)Levels: Contrast
let fxImage: UIImage = image.fxContrast(2.0)Quantize
let fxImage: UIImage = image.fxQuantize(0.125)Sharpen
let fxImage: UIImage = image.fxSharpen(2.0)Slope
let fxImage: UIImage = image.fxSlope()Threshold
let fxImage: UIImage = image.fxThreshold()Twirl
let fxImage: UIImage = image.fxTwirl()Transform
let fxImage: UIImage = image.Sepia
let fxImage: UIImage = image.fxSepia(color: .orange)Range
let fxImage: UIImage = image.fxRange(inLow: 0.0, inHigh: 1.0, outLow: 0.0, outHigh: 0.5)
let fxImage: UIImage = image.fxRange(inLow: .black, inHigh: .white, outLow: .black, outHigh: .gray)Saturation
let fxImage: UIImage = image.fxSaturation(0.5)
let fxImage: UIImage = image.fxMonochrome()Hue
let fxImage: UIImage = image.fxHue(0.5)



















