Hmm.. I'm a bit confused. I thought that when you convert a
selection to a path, the new path follows the exact location of the
selection. (Therefore conversion from the selection bounds to the path
should be pixel exact) Nope. Wand some part of a photograph and zoom in to %1600. Then make the selection a workpath with various tolerance levels. At 0.5 you get a very good approximation, but converting between bitmap graphics and vector graphics will never be pixel perfect. What I don't know how to do (if it's even possible) is program
Photoshop using scripts to alter each and every pixel on the path using
an algorithm similar to what you described. You can use the Path APIs in PS to describe as many points on a path as you need. BTW, when you ".. skip it and check the next point on the path" what
path are we talking about (we just rejected a test point on the current
path because it was out of alignment). The new path hasn't even been
defined yet. Even if you used the next point on a tangent to the
previous two points as the new path, what's to say that that tangent
will meet up with the correct portion of the path? A better way of looking at the this is that you traverse the path. If the next point is way out of whack, delete it and check the next point. If the border defects aren't too large, you eventually find a point that is near enough that you can discard/delete the intermediate points, though you do end up with a small flat part on the circle. NetGeek888, has an interesting idea (see my commet to his post) If you are going to have a user tweaking the selection, I'd take the bounds of the initial wand selection, as he suggests, create a circle in those bounds, and let the user adjust the circle's size and location. You probably need to start coding some of these ideas up and see what's reasonable for your workflow.
... View more