Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIBezierPath from image

I have several png files that look similar to this this:

enter image description here

Everything is transparent but the black path. What I am trying to do is create a UIBezierPath from the non transparent part.

Edit: So I was thinking what about creating a mask with the png then from the mask go to a UIBezierPath. Would that work?

Edit Again: I found the solution, look at my answer.

like image 600
Jonathan Avatar asked Mar 06 '13 16:03

Jonathan


2 Answers

I went a different direction. Instead of using PNGs I went with SVG and used PocketSVG to parse the file. It works great.

like image 139
Jonathan Avatar answered Sep 16 '22 15:09

Jonathan


The process you're looking for is known as skeletonization, there's a good summary of techniques in this post: Determine the midline of a bent, elongated region

like image 28
kineticfocus Avatar answered Sep 19 '22 15:09

kineticfocus