handles cropping the images