Skip to content

Performance of _repr_png_ with larger images #7241

Closed
@smason

Description

I've just been using PIL to work with some larger images in IPython/Jupyter (~3k by 2k pixel images) and noticed that it can take a long time (nearly 10 seconds) for them to appear in the output. I had a poke in the code and found that it's due to Image._repr_png_ using default compression levels which is causing it to take a significant amount of time.

I tried adding compress_level=1 to the save call which reduces the wait to a couple of seconds–much nicer for interactive use.

I see it's had a recent refactor (in #7135) to also include JPEG support which is nice, but I could put a quick patch together if making this sort of change is considered sensible.

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