There is no easy way to do this, since the path is part of vector graphics, while the bitmap consists of independent pixels. You can create an algorithm that will do this, but it will be complex and will never be 100% sure.
The best thing you can do is either start with vector graphics in the first place (for example, SVG), or abandon the dream of scalable graphics.
Sorry to disappoint you, but I tried to create a pseudo-code vector finder here, and even the simplest one is too complicated to write on the fly.
source
share