Hi, this is possible to do by writing a "following" algorithm which walks the edge of the image. Firstly,however, for a digital photo image you need to do image enhancement using and edge detector called a canny edge detector. The canny detector usually gives you a nice 1 pixel edge. After that you can use an algorithm which will simply follow the edge - basically tracing along it. This will put the pixels in the right order automatically. After that you can then also walk thru the points and calculate the angles between each pixel - if the pixel is straight, for example, like the pixel above the current one is straight above, you could optimize the line by just jumping to that location until a pixel "shift" occurs which would indicate the line is changing direction.
Really you only need basic math to do the more complex stuff, the canny edge detector is the most difficult part to implement, but it is certianly doable even in VB (although it may be a bit slower)