resize image
distance as params
improved distance