mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-18 19:24:47 +03:00
handshake to set compress_level to minimum if save() is called from show()
The last in a series of changes to fix https://github.com/python-pillow/Pillow/issues/2508
This commit is contained in:
parent
dc542cb0e6
commit
f79cbe81c9
|
@ -71,6 +71,7 @@ class Viewer(object):
|
|||
base = Image.getmodebase(image.mode)
|
||||
if base != image.mode and image.mode != "1" and image.mode != "RGBA":
|
||||
image = image.convert(base)
|
||||
image.info['showing'] = True
|
||||
|
||||
return self.show_image(image, **options)
|
||||
|
||||
|
|
|
@ -687,6 +687,9 @@ def _save(im, fp, filename, chunk=putchunk, check=0):
|
|||
mode = "%s;%d" % (mode, bits)
|
||||
|
||||
# encoder options
|
||||
if (im.info.get('showing', False)):
|
||||
im.encoderinfo['compress_level'] = 1
|
||||
im.info.pop('showing', None)
|
||||
im.encoderconfig = (im.encoderinfo.get("optimize", False),
|
||||
im.encoderinfo.get("compress_level", -1),
|
||||
im.encoderinfo.get("compress_type", -1),
|
||||
|
|
Loading…
Reference in New Issue
Block a user