HumanSignal / HumanSignal/label-studio

Coco export do not use image orientation when setting image height and width in result.json

Open
#6,608 3 comments 0 reactions 0 assignees View on GitHub
community_reviewed
Dominant language
TypeScript
Stars
28.3k
Forks
3.7k
Avg merge
14h
Merged PRs (30d)
15

Description

**Describe the bug**
When I export with "Coco export". The resulting "result.json" contains bad image width and height. In fact this export do not respect image orientation. So It set width as height and height as width.

**To Reproduce**
Steps to reproduce the behavior:
1. Take a portrait picture with your phone
2. Import in label-studio (the image is correctly shown in label-studio)
3. Add one annotation on this picture
4. Export project with "Coco export"
5. Open result.json from exported zip file
6. See that image width and height are incorrect.

**Expected behavior**
Coco export should rotate image according to image orientation before getting its size and height (the ones that are set in result.json)

**Environment (please complete the following information):**
- OS: Debien
- Label Studio Version: 1.14.0

**How to bypass the bug**
- I checked database in .local/share/label-studio/label_studio.sqlite3 everything about my image seems correct.
- I opened .local/share/label-studio/upload/1
- My image is correctly (correct orientation) shown when I open it with default debian image viewer
- When I open the image with gimp, Gimp advise me to rotate image according to orientation. So yes "original image" is 90° incorrect. But when Gimp applied image orientation, then image is correct. So I overwrite image with Gimp. Then the Coco Export work great for this image. But I was having errors on all other portraits images
- Finally I run command "mogrify -auto-orient *.jpg" in folder .local/share/label-studio/upload/1 to fix all images orientation. Then Coco export worked perfectly

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.