From 9f8aeb5d8e9405fcda137b030b16f30efa18278e Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Wed, 10 May 2017 21:07:31 +0100 Subject: [PATCH] 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 --- PIL/Image.py | 6 +++--- PIL/ImageShow.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/PIL/Image.py b/PIL/Image.py index c11c4cb3f..3026d1388 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -577,7 +577,7 @@ class Image(object): self.pyaccess = None self.readonly = 0 - def _dump(self, file=None, format=None): + def _dump(self, file=None, format=None, **options): import tempfile suffix = '' if format: @@ -588,11 +588,11 @@ class Image(object): self.load() if not format or format == "PPM": - self.im.save_ppm(file) + self.im.save_ppm(file, **options) else: if not file.endswith(format): file = file + "." + format - self.save(file, format) + self.save(file, format, **options) return file def __eq__(self, other): diff --git a/PIL/ImageShow.py b/PIL/ImageShow.py index 23e0126a7..6ea574d73 100644 --- a/PIL/ImageShow.py +++ b/PIL/ImageShow.py @@ -87,7 +87,7 @@ class Viewer(object): def save_image(self, image): """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): """Display given image"""