Created
May 26, 2021 07:01
-
-
Save iosdevie/4fa5bf6c8d1af5521bd0cc9a995ab0e7 to your computer and use it in GitHub Desktop.
Get UIImage from Pencilkit canvas iOS 13
This file contains hidden or 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
func preprocessImage() -> UIImage{ | |
var image = canvasView.drawing.image(from: canvasView.drawing.bounds, scale: 10.0) | |
if let newImage = UIImage(color: .black, size: CGSize(width: view.frame.width, height: view.frame.height)){ | |
if let overlayedImage = newImage.image(byDrawingImage: image, inRect: CGRect(x: view.center.x, y: view.center.y, width: view.frame.width, height: view.frame.height)){ | |
image = overlayedImage | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment