I would like to create a NSBezierPath object which corresponds to the outline of an arbitrary bitmap image.
All my images are png solid monochrome shapes with transparent backgrounds. Here is an examplee:
I want the bezier path of the outline of the shape. What is the bast way to achieve this?
What you are looking for is a tracing/vectorization algorithm.
DrawKit appears to support bitmap to vector tracing:
Some other (non-ObjC) open-source projects implementing tracing (for code reference):
Anyone who has ever used Illustrator's (or any of its competitors') tracing tools can assure you that tracing is a non-trivial thing, though. But for your simple b&w images (technically graysacle, due to antialiasing, but that's rather neglectable here) just about any algorithm should do the trick. Especially if you don't even need perfect curve fitting, as you noted.