resize() got an unexpected keyword argument 'interpolation'
时间: 2023-10-01 11:06:56 浏览: 113
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.
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)