Fixes rotated image
[librarian.git] / src / librarian / covers / widgets / background.py
index fd8c764..1f5bf0f 100644 (file)
@@ -1,7 +1,11 @@
+# This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
+#
 import io
 import time
 from urllib.request import urlopen
 import PIL.Image
+from PIL import ImageOps
 from .base import Widget
 
 
@@ -24,6 +28,7 @@ class Background(Widget):
                     break
                 
             img = PIL.Image.open(data)
+            img = ImageOps.exif_transpose(img)
 
             if self.crop_to_square:
                 # crop top square.