mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Apply EXIF-orientation data from source image to thumbnail with PIL.ImageOps.exif_transpose (#1869)
This commit is contained in:
committed by
GitHub
parent
a452bf816c
commit
978130551a
@@ -3,7 +3,7 @@ from io import BytesIO
|
||||
|
||||
from django.core.files.base import ContentFile
|
||||
from django.core.files.storage import default_storage
|
||||
from PIL import Image
|
||||
from PIL import Image, ImageOps
|
||||
from PIL.Image import LANCZOS
|
||||
|
||||
from pretix.helpers.models import Thumbnail
|
||||
@@ -56,6 +56,9 @@ def create_thumbnail(sourcename, size):
|
||||
except:
|
||||
raise ThumbnailError('Could not load image')
|
||||
|
||||
# before we calc thumbnail, we need to check and apply EXIF-orientation
|
||||
image = ImageOps.exif_transpose(image)
|
||||
|
||||
scale, crop = get_sizes(size, image.size)
|
||||
image = image.resize(scale, resample=LANCZOS)
|
||||
if crop:
|
||||
|
||||
Reference in New Issue
Block a user