我有一个大小的图像(288,352).我想将其调整为(160,240).我尝试了以下代码:
im = imread('abc.png')
img = im.resize((160, 240), Image.ANTIALIAS)
Run Code Online (Sandbox Code Playgroud)
但它给出了错误TypeError: an integer is required
请告诉我最好的方法.
matplotlib.pyplot.imread(或scipy.ndimage.imread)返回NumPy数组,而不是PIL图像.
而是尝试:
In [25]: import Image
In [26]: img = Image.open(FILENAME)
In [32]: img.size
Out[32]: (250, 250)
In [27]: img = img.resize((160, 240), Image.ANTIALIAS)
In [28]: img.size
Out[28]: (160, 240)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4432 次 |
| 最近记录: |