added an optional argument to autocrop the image