I have several png files that look similar to this this:
Everything is tra
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
I went a different direction. Instead of using PNGs I went with SVG and used PocketSVG to parse the file. It works great.