How do I resize an image using PIL and maintain its aspect ratio?

后端 未结 20 2262
-上瘾入骨i
-上瘾入骨i 2020-11-22 02:30

Is there an obvious way to do this that I\'m missing? I\'m just trying to make thumbnails.

20条回答
  •  感动是毒
    2020-11-22 02:58

    PIL already has the option to crop an image

    img = ImageOps.fit(img, size, Image.ANTIALIAS)
    

提交回复
热议问题