Skip to content

Commit 86daa77

Browse files
committed
Fix image upload rotation
1 parent dd2902f commit 86daa77

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

superannotate/db/projects.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import boto3
1414
import cv2
1515
import ffmpeg
16-
from PIL import Image
16+
from PIL import Image, ImageOps, ImageChops
1717
from tqdm import tqdm
1818

1919
from ..api import API
@@ -600,11 +600,14 @@ def upload_images_from_folder_to_project(
600600

601601
def get_image_array_to_upload(byte_io_orig, image_quality_in_editor):
602602
Image.MAX_IMAGE_PIXELS = None
603-
im = Image.open(byte_io_orig)
604-
im_format = im.format
603+
im_original = Image.open(byte_io_orig)
604+
im_format = im_original.format
605+
im = ImageOps.exif_transpose(im_original)
605606
width, height = im.size
606607

607-
if image_quality_in_editor == 100 and im_format in ['JPEG', 'JPG']:
608+
if image_quality_in_editor == 100 and im_format in [
609+
'JPEG', 'JPG'
610+
] and not ImageChops.difference(im, im_original).getbbox():
608611
byte_io_lores = io.BytesIO(byte_io_orig.getbuffer())
609612
else:
610613
byte_io_lores = io.BytesIO()

superannotate/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.3.17"
1+
__version__ = "2.3.18"

0 commit comments

Comments
 (0)