I am using PencilKit
framework to capture a user's drawing and save it.
I want to save a user input drawing with a white background. The image should look like this, where the canvas background I have is white.
I use the UIImage
api from drawing.image(from: bounds, scale: 1.0)
and save it. On saving the image, I get the following instead
It seems the background has been removed, although I want it kept. I want to later later convert the image into pixel values where white = 255 and black = 0 intensity.
How do I do this with Swift?
Thank you all for your guidance and help.