"stitching"

i was wondering if anyone knew the easiest way to do the stitch-like bordering in the icon i'm using right now and how to change the size of each "stitch." are there also ways to do any shaped trail of the stitches, not just a square border but something that surrounds a certain shape in a picture? thanks for any help you can give me. oh and i use photoshop cs2.

credit for the icon goes to atmosphered.