resize() got an unexpected keyword argument 'interpolation'
时间: 2023-10-01 12:06:56 浏览: 228
php缩放图片类resizeimage
4星 · 用户满意度95%
This error occurs when the `resize()` function is called with an unexpected keyword argument `interpolation`. The `resize()` function is used to resize an image to a specified width and height. It does not have an `interpolation` parameter.
To fix this error, remove the `interpolation` parameter from the `resize()` function call. If you need to specify the interpolation method, you can use the `interpolation` parameter of the `ImageOps.scale()` function instead. For example:
```
from PIL import Image, ImageOps
img = Image.open("image.jpg")
resized_img = ImageOps.scale(img, (300, 300), Image.BICUBIC)
```
Here, we use the `ImageOps.scale()` function to resize the image to 300x300 pixels using the bicubic interpolation method.
阅读全文