Created
January 5, 2018 10:56
-
-
Save lukas2/9723e3b125e5eaf856848c5c015adca5 to your computer and use it in GitHub Desktop.
How to apply CI Filter in Swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// example with CIColorPosterize | |
let context = CIContext(options: nil) | |
var ciImage = CIImage(cgImage: image.cgImage!) | |
ciImage = ciImage.applyingFilter("CIColorPosterize", parameters: ["inputImage" : ciImage, "inputLevels" : 2]) | |
let cgImage = context.createCGImage(ciImage, from: ciImage.extent)! | |
let filteredUiImage = UIImage(cgImage: cgImage, scale: image.scale, orientation: .up) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I've tried this for CIMaskToAlpha in my generating QR Code functio, but it didn't work. Do u have any solution?