Migrating to PencilKit

I implemented a drawing canvas before PencilKit was released. The drawings were stored as PNGData. Is there a way to convert PNGData or a UIImage to a PKDrawing so I can migrate to PencilKit?

Accepted Reply

There is not an API to convert from image data into a PencilKit drawing. It is possible to synthesize PencilKit drawings using APIs added in iOS 14. For details check out this session: Inspect, modify, and construct PencilKit drawings.

Replies

There is not an API to convert from image data into a PencilKit drawing. It is possible to synthesize PencilKit drawings using APIs added in iOS 14. For details check out this session: Inspect, modify, and construct PencilKit drawings.

Related to this: I have a drawing canvas as well, and have stored the history for all ink/eraser paths. I'd like to migrate that data into a PKDrawing. It seems that migrating ink can be done by creating new PKStrokes with the point/path/ink data I have. However, I don't see a way to migrate eraser paths.

Is there a way to generate new eraser strokes programmatically for a PKDrawing?
Any luck with this @adamwulf?

I'm trying to do something similar in supporting some pre-PencilKit drawing data. I've been able to serialize my data into and out of PKDrawing data, but am struggling with eraser support.