尝试使用以下方法调整图像大小(重量>100 MB):
>>> from PIL import Image
>>> image = Image.open(path_to_the_file)
>>> new_image = image.resize((200, 200))
和接收到值错误:平铺无法扩展到图像外部。在
原始图像的大小为
^{pr2}$我在做缩略图、旋转等时也收到了同样的错误
我做错什么了?在
编辑: 使用ImageMagic检查图像:
$ identify file.tif
file.tif[0] TIFF 4922x3707 4922x3707+0+0 32-bit Grayscale Gray 31.23MB 0.000u 0:00.009
file.tif[1] TIFF 2461x1854 2461x1854+0+0 32-bit Grayscale Gray 31.23MB 0.000u 0:00.000
filetif[2] TIFF 1231x927 1231x927+0+0 32-bit Grayscale Gray 31.23MB 0.000u 0:00.000
file.tif[3] TIFF 616x464 616x464+0+0 32-bit Grayscale Gray 31.23MB 0.000u 0:00.000
file.tif[4] TIFF 308x232 308x232+0+0 32-bit Grayscale Gray 31.23MB 0.000u 0:00.000
file.tif[5] TIFF 154x116 154x116+0+0 32-bit Grayscale Gray 31.23MB 0.000u 0:00.000
identify: Unknown field with tag 33550 (0x830e) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/881.
identify: Unknown field with tag 33922 (0x8482) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/881.
identify: Unknown field with tag 34735 (0x87af) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/881.
identify: Unknown field with tag 34736 (0x87b0) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/881.
尝试添加
Image.ANTIALIAS
参数:在我以前的一个项目中,这对我很有用。在
您应该安装pytho resize图像包。在
一个例子
您可以使用安装程序包
^{pr2}$问题可能在这里,从docs:
在本例中,在代码处添加
Image.ANTIALIAS
现在就可以了。在
相关问题 更多 >
编程相关推荐