better resampling support, added cropping