Home > Software engineering >  Convert Swift UIImage to UIBezierPath
Convert Swift UIImage to UIBezierPath

Time:09-10

Can I convert my UIImage to a BezierPath in Swift? I converted it from a BezierPath to a UIImage with the following line.

let image: UIImage = UIImage.shapeImageWithBezierPath(bezierPath: path, fillColor: .white, strokeColor: .black)

When I pull my image back from my database it's in base64, so I convert it back into an image with the following code.

let stringData = Data(base64Encoded: mydata)
let uiImage = UIImage(data: stringData!)

I am unsure how to convert from an Image back to a BezierPath.

Thanks for any help!!!!

CodePudding user response:

Unfortunately you cannot convert to UIBezierPath because once it's converted to an UIImage.

You can only add additional UIBezierPath's to the UIImage that's been created from base64 data but not the other way around.

  • Related