0

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!!!!

micah
  • 838
  • 7
  • 21
  • This is an unusual problem, why would you need to convert a bezier path from an image? What are you trying to extract from that image? – Cristik Sep 10 '22 at 05:02
  • @Cristik I’m trying to pull a signature because the bezier path can be displayed in an annotation field in pdfkit, but I haven’t discovered a way to do so with an image yet https://stackoverflow.com/questions/73662970/swift-pdfkit-put-image-in-image-field – micah Sep 11 '22 at 20:10

1 Answers1

1

Unfortunately you cannot convert to UIBezierPath 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.

Vikram Parimi
  • 777
  • 6
  • 29