now do auto resampling in addition to auto cropping