3
我想使用Python根据以下2个条件调整任何图像的大小。当两边大于1280时使用Python调整图像大小
1)如果图像是横向,则获取宽度,如果大于1280
调整图像宽度为1280 保持纵横比。
2)如果图像是肖像,得到高度,如果大于1280
大小调整高度为1280 保持纵横比。
在Python中最好的包装/方法是什么?不知道如何使用这个是我看到它的工作原理。
伪代码:
If image.height > image.width:
size = image.height
If image.height < image.width:
size = image.width
If size > 1280:
resize maintaining aspect ratio
我看着Pillow
(PIL)。
你能解释一下你的代码吗? – kn3l 2015-08-12 11:30:53