Convert PKDrawing UIImage to use white background

I am using PencilKit framework to capture a user's drawing. The user draws on a white backgrounded canvas. However, the UIImage that I get from drawing.image(bounds: rect, scale=1) gives me an image without the white background. When I save the drawing, it does not look like it has a white background. I would like the property of the drawing image to show a white background. This is because I will be converting the UIImage into it's respective pixel array, so intensity of white = 255 and black = 0. The current api does not allow me to do so.

Terms of Service

Privacy Policy

Cookie Policy