added variable padding to crop_img