Skip to content

Commit

Permalink
Rotate the image according to EXIF to obtain the correct image size (H…
Browse files Browse the repository at this point in the history
…umanSignal#158)

Co-authored-by: pengfei.chen <chenpengfei@orientalmind.com>
  • Loading branch information
ChenPengf and pengfei.chen authored Aug 31, 2022
1 parent 7eaa90b commit 32a2b68
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions label_studio_ml/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

from PIL import Image
from PIL import Image, ImageOps

from label_studio_tools.core.utils.params import get_env
from label_studio_tools.core.utils.io import get_local_path
Expand Down Expand Up @@ -47,4 +47,6 @@ def get_image_local_path(url, image_cache_dir=None, project_dir=None, image_dir=


def get_image_size(filepath):
return Image.open(filepath).size
img = Image.open(filepath)
img = ImageOps.exif_transpose(img)
return img.size

0 comments on commit 32a2b68

Please sign in to comment.