0

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.

enter image description here

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

enter image description here

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.

jnpdx
  • 45,847
  • 6
  • 64
  • 94
calveeen
  • 621
  • 2
  • 10
  • 28

0 Answers0