From 58a80ad3a903c5ee365c15ca349cc1e8d865bcf9 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 2 Jul 2021 13:05:02 +0200 Subject: [PATCH] speed improvements --- src/PIL/ImageOps.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PIL/ImageOps.py b/src/PIL/ImageOps.py index f210f0d32..24c56267b 100644 --- a/src/PIL/ImageOps.py +++ b/src/PIL/ImageOps.py @@ -568,14 +568,14 @@ def solarize(image, threshold=128): def exif_transpose(image): """ - Transpose an image accordingly if it has an EXIF Orientation tag + Transpose a PIL image accordingly if it has an EXIF Orientation tag. :param image: The image to transpose. :return: An image. """ exif = image.getexif() - orientation = exif.get(0x0112) - if orientation is not None: + orientation = exif.get(0x0112, 1) # default 1 + if orientation > 1: method = {2: Image.FLIP_LEFT_RIGHT, 3: Image.ROTATE_180, 4: Image.FLIP_TOP_BOTTOM,