小编lis*_*isa的帖子

“图像”对象没有“读取”属性

我想使用存储在字典中的图像将其转换为 GIF。字典里的图片是这样的:

people={
    1: <PIL.Image.Image image mode=RGBA size=16x16 at 0x10962C510>,
    2: <PIL.Image.Image image mode=RGBA size=16x16 at 0x1098D7F90>,
    3: <PIL.Image.Image image mode=RGBA size=16x16 at 0x1098D7F50>}
Run Code Online (Sandbox Code Playgroud)

我认为是枕头图像。但是为什么我总是收到这个错误:

“图像”对象没有“读取”属性

这是什么意思?

完整的错误:

File "/***view.py", line 266, in convert_gif
    new_frame = Image.open(imgs[count])
File "/***/python3.7/site-packages/PIL/Image.py", line 2775, in open
    prefix = fp.read(16)
AttributeError: 'Image' object has no attribute 'read' –
Run Code Online (Sandbox Code Playgroud)

编码:

self._images = { 
    people: {
        1: <PIL.Image.Image image mode=RGBA size=16x16 at 0x10962C510>, 
        2: <PIL.Image.Image image mode=RGBA size=16x16 at 0x1098D7F90>, 
        3: <PIL.Image.Image image mode=RGBA size=16x16 at …
Run Code Online (Sandbox Code Playgroud)

python python-imaging-library python-3.x

4
推荐指数
1
解决办法
8968
查看次数