2024-03-28 10:26:55 发布
网友
我正在用python将图像大小调整为50 x 50。Skimage transform和PIL thumbnail都在保持纵横比的同时调整图像的大小。 另一种方法是什么? 我试过: 对于PIL缩略图
im.thumbnail((50,50),Image.ANTIALIAS)
这给了我一个(42,50)图像,而不是(50,50)图像。
为撇油.transform
它返回一个完全扭曲的图像。
要将大小调整为固定大小,同时保持纵横比和裁剪以适合,请使用^{}
import PIL.ImageOps import PIL.Image impath = '1-True Mountain Covered with Cloud.jpg' im = PIL.Image.open(impath) display(im)
使用im.resize((50,50), Image.ANTIALIAS)
im.resize((50,50), Image.ANTIALIAS)
要将大小调整为固定大小,同时保持纵横比和裁剪以适合,请使用^{}
^{pr2}$
使用
im.resize((50,50), Image.ANTIALIAS)
相关问题 更多 >
编程相关推荐