first implementation of adaptive cropping