crop by width or height according to shape comparison