bumptech / bumptech/glide

DefaultImageHeaderParser fails to determine correct orientation

Open
#3,944 7 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
35k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
8

Description

**Glide Version**: 4.10.0

**Integration libraries**: none

**Device/Android Version**: Pixel 2 XL Android 10

**Issue details / Repro steps / Use case background**: Glide (but in its defense also my browser) fails to determine the orientation of this image:

![rotate-test](https://user-images.githubusercontent.com/244947/67391990-16dc6780-f576-11e9-8a76-e41e5c2ae52c.jpg)

[`DefaultImageHeaderParser#getOrientation()`](https://github.com/bumptech/glide/blob/6022f500e18fccfbe364ceabccc29d153bceb930/library/src/main/java/com/bumptech/glide/load/resource/bitmap/DefaultImageHeaderParser.java#L163) returns `UNKNOWN_ORIENTATION`.

However, Android's gallery app and my Linux image viewer apps display the orientation correctly. Here's jhead output:

```
Resolution : 800 x 600
Orientation : rotate 90
Jpeg process : Progressive
JPEG Quality : 93
```

So the orientation is in there, but maybe it is hard to parse?

Contributor guide

Open the contributing guide

Research direction

Start with library/src/main/java/com/bumptech/glide/load/resource/bitmap/DefaultImageHeaderParser.java, especially getOrientation(), and reproduce the issue with the linked JPEG on the reported Android setup. Compare the parser result with the orientation reported by jhead and the expected 90-degree rotation. Done means the image's orientation is detected instead of returning UNKNOWN_ORIENTATION.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.