import smartcrop
from PIL import Image

sc = smartcrop.SmartCrop()
img = Image.open("imagem.jpg")
result = sc.crop(img, width=300, height=300)
crop = img.crop((
    result['top_crop']['x'],
    result['top_crop']['y'],
    result['top_crop']['x'] + result['top_crop']['width'],
    result['top_crop']['y'] + result['top_crop']['height']
))
crop.save("imagem_cropada.jpg")

