mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-21 21:12:40 +00:00
Fix: apply EXIF orientation when cropping zone images
This commit is contained in:
1 parent
a54141058d
commit
ad5a7b365e
2 files changed
+43
-1
No files matched your search
@@ -34,6 +34,7 @@ from django.db.models import F
|
||||
from django.db.models import Field
|
||||
from django.utils import timezone
|
||||
from PIL import Image
|
||||
from PIL import ImageOps
|
||||
|
||||
from documents.matching import matches
|
||||
from documents.models import CustomField
|
||||
@@ -756,7 +757,7 @@ def _crop_zone(
|
||||
) -> Image.Image | None:
|
||||
"""Crop a zone from the page image and return the PIL Image."""
|
||||
try:
|
||||
with Image.open(page_img) as img:
|
||||
with Image.open(page_img) as opened, ImageOps.exif_transpose(opened) as img:
|
||||
img_width, img_height = img.size
|
||||
if not source_width or not source_height:
|
||||
source_width, source_height = img.size
|
||||
|
||||
Reference in new issue
Block a user