From d9d9a2b00b2c0c1a39153b80688ad2e8ab169553 Mon Sep 17 00:00:00 2001 From: Uri Date: Mon, 8 Aug 2022 18:08:42 +0300 Subject: [PATCH] sorl/thumbnail/engines/pil_engine.py - Changed code to a more readable format. --- sorl/thumbnail/engines/pil_engine.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/sorl/thumbnail/engines/pil_engine.py b/sorl/thumbnail/engines/pil_engine.py index d27e941fa..5371be42c 100644 --- a/sorl/thumbnail/engines/pil_engine.py +++ b/sorl/thumbnail/engines/pil_engine.py @@ -10,14 +10,17 @@ import ImageDraw import ImageMode -ANTIALIAS = Image.Resampling.LANCZOS if hasattr(Image, 'Resampling') else Image.ANTIALIAS +if hasattr(Image, 'Resampling'): + ANTIALIAS = Image.Resampling.LANCZOS +else: + ANTIALIAS = Image.ANTIALIAS # Image.Transpose added in 9.1.0 -FLIP_LEFT_RIGHT = ( - Image.Transpose.FLIP_LEFT_RIGHT if hasattr(Image, 'Transpose') else Image.FLIP_LEFT_RIGHT -) -FLIP_TOP_BOTTOM = ( - Image.Transpose.FLIP_TOP_BOTTOM if hasattr(Image, 'Transpose') else Image.FLIP_TOP_BOTTOM -) +if hasattr(Image, 'Transpose'): + FLIP_LEFT_RIGHT = Image.Transpose.FLIP_LEFT_RIGHT + FLIP_TOP_BOTTOM = Image.Transpose.FLIP_TOP_BOTTOM +else: + FLIP_LEFT_RIGHT = Image.FLIP_LEFT_RIGHT + FLIP_TOP_BOTTOM = Image.FLIP_TOP_BOTTOM EXIF_ORIENTATION = 0x0112