Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Modify pixels of a UIImage
func applyFilter(to image: UIImage) -> UIImage? {
guard let context = prepareContext(for: image),
let pixelBuffer = getPixelBuffer(from: context) else {
return nil
}
// TODO: Hier müssen wir die einzelnen Pixel im pixelBuffer modifizieren und wieder
// zurück in den pixelBuffer schreiben.
guard let outputCGImage = context.makeImage() else {
return nil
}
return UIImage(cgImage: outputCGImage, scale: image.scale, orientation: image.imageOrientation)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.