diff --git a/backend/routes/dogs.py b/backend/routes/dogs.py index a58c757..bfa8517 100644 --- a/backend/routes/dogs.py +++ b/backend/routes/dogs.py @@ -134,7 +134,10 @@ async def upload_photo( content = await file.read() try: - img = Image.open(io.BytesIO(content)).convert("RGB") + from PIL import ImageOps + img = Image.open(io.BytesIO(content)) + img = ImageOps.exif_transpose(img) # EXIF-Orientierung anwenden + img = img.convert("RGB") buf = io.BytesIO() img.save(buf, format="JPEG", quality=90) content = buf.getvalue() diff --git a/backend/routes/profile.py b/backend/routes/profile.py index 1be34d4..52ef2b5 100644 --- a/backend/routes/profile.py +++ b/backend/routes/profile.py @@ -84,11 +84,13 @@ async def upload_avatar( except ImportError: pass - from PIL import Image + from PIL import Image, ImageOps content = await file.read() try: - img = Image.open(io.BytesIO(content)).convert("RGB") + img = Image.open(io.BytesIO(content)) + img = ImageOps.exif_transpose(img) # EXIF-Orientierung anwenden + img = img.convert("RGB") buf = io.BytesIO() img.save(buf, format="JPEG", quality=90) content = buf.getvalue()