Skip to content

Prioritise speed in _repr_png_#7242

Merged
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:repr_png
Jun 30, 2023
Merged

Prioritise speed in _repr_png_#7242
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:repr_png

Conversation

@radarhere
Copy link
Member

Resolves #7241

When ImageShow saves an image as a PNG, it uses "compress_level" of 1

Pillow/src/PIL/ImageShow.py

Lines 177 to 178 in 1174a9e

format = "PNG"
options = {"compress_level": 1, "save_all": True}

This prioritises speed over file size, presumably because this image is intended to just be shown, not saved for later use.

That same logic would apply to _repr_png, so this PR adds "compress_level" of 1 to that functionality as well.

@hugovk hugovk merged commit bd795d7 into python-pillow:main Jun 30, 2023
@radarhere radarhere deleted the repr_png branch June 30, 2023 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Performance of _repr_png_ with larger images

2 participants