Skip to content

AttributeError: 'Image' object has no attribute 'encoderinfo'. Did you mean: 'encoderconfig'? #8936

Open
@ThomasDevoogdt

Description

@ThomasDevoogdt

Traceback:

>     image.save("reference.jpg")
>   File "/usr/local/lib/python3.12/dist-packages/PIL/Image.py", line 2596, in save
>     save_handler(self, fp, filename)
>   File "/usr/local/lib/python3.12/dist-packages/PIL/JpegImagePlugin.py", line 670, in _save
>     info = im.encoderinfo
>            ^^^^^^^^^^^^^^
> AttributeError: 'Image' object has no attribute 'encoderinfo'. Did you mean: 'encoderconfig'?

Version Used:

Ubuntu 24.04 LTS
Python 3.12.3
Pillow 11.1.0

I recently bumped Pillow from 9.3.0 to 11.1.0. At some point in the code, image = Image.open(io.BytesIO(bytes)) is used to create a Pillow image. I get the trackback as above when trying to save. Since this code did work for ages, I would expect that some Pillow change is to blame.

I see that JpegImagePlugin.py (line 670), tries to get encoderinfo. I don't know the Pillow code at all, but a wild guess is that this commit radarhere@203ca12 is related to the issue I see now. Perhaps I can just work-around this bug by assigning a dict to encoderinfo myself for now, will update you if that work-around did the trick.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions