smartcrop implementation in Python