put compress_level=1 inside Image._dump()

Better alternative to setting compress_level=1 than the secret handshake
in the last attempt.

The last in a series of changes to fix
https://github.com/python-pillow/Pillow/issues/2508
This commit is contained in:
Hin-Tak Leung 2017-05-10 21:07:31 +01:00 committed by wiredfool
parent 74da5878c5
commit 9f8aeb5d8e
2 changed files with 4 additions and 4 deletions

View File

@ -577,7 +577,7 @@ class Image(object):
self.pyaccess = None self.pyaccess = None
self.readonly = 0 self.readonly = 0
def _dump(self, file=None, format=None): def _dump(self, file=None, format=None, **options):
import tempfile import tempfile
suffix = '' suffix = ''
if format: if format:
@ -588,11 +588,11 @@ class Image(object):
self.load() self.load()
if not format or format == "PPM": if not format or format == "PPM":
self.im.save_ppm(file) self.im.save_ppm(file, **options)
else: else:
if not file.endswith(format): if not file.endswith(format):
file = file + "." + format file = file + "." + format
self.save(file, format) self.save(file, format, **options)
return file return file
def __eq__(self, other): def __eq__(self, other):

View File

@ -87,7 +87,7 @@ class Viewer(object):
def save_image(self, image): def save_image(self, image):
"""Save to temporary file, and return filename""" """Save to temporary file, and return filename"""
return image._dump(format=self.get_format(image)) return image._dump(format=self.get_format(image), compress_level=1)
def show_image(self, image, **options): def show_image(self, image, **options):
"""Display given image""" """Display given image"""