From f50feb592bfc3247783673030b0fc22339f453dd Mon Sep 17 00:00:00 2001 From: Ronald Oussoren Date: Tue, 26 Mar 2013 13:36:13 +0100 Subject: [PATCH] Explitly import JpegPresets from the PIL package --- PIL/JpegImagePlugin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PIL/JpegImagePlugin.py b/PIL/JpegImagePlugin.py index a9bb120b9..1c260dd6b 100644 --- a/PIL/JpegImagePlugin.py +++ b/PIL/JpegImagePlugin.py @@ -36,7 +36,7 @@ __version__ = "0.6" import array, struct from PIL import Image, ImageFile, _binary -from JpegPresets import presets +from PIL.JpegPresets import presets i8 = _binary.i8 o8 = _binary.o8 @@ -483,7 +483,7 @@ def _save(im, fp, filename): elif subsampling == "keep": if im.format != "JPEG": raise ValueError("Cannot use 'keep' when original image is not a JPEG") - subsampling = get_sampling(im) + subsampling = get_sampling(im) def validate_qtables(qtables): if qtables is None: @@ -513,7 +513,7 @@ def _save(im, fp, filename): else: qtables[idx] = list(table) return qtables - + if qtables == "keep": if im.format != "JPEG": raise ValueError("Cannot use 'keep' when original image is not a JPEG") @@ -560,7 +560,7 @@ def _save(im, fp, filename): # https://github.com/jdriscoll/django-imagekit/issues/50 bufsize=0 if "optimize" in info: - bufsize = im.size[0]*im.size[1] + bufsize = im.size[0]*im.size[1] ImageFile._save(im, fp, [("jpeg", (0,0)+im.size, 0, rawmode)], bufsize)