imDist function

Calculates the distance between non-transparent pixels in images