signalapp / Signal-Android

A private messenger for Android.
https://signal.org
GNU Affero General Public License v3.0
25.42k stars 6.09k forks source link

Large images displayed in incorrect orientation #11614

Closed goughy000 closed 2 years ago

goughy000 commented 2 years ago

When receiving high dimension photos from one of my contacts (iPhone X), the photos show in the correct orientation when in the thumbnail but are rotated 90 degrees when tapped on to show full screen. Other users in our group chat who are on Android also see the same issue when receiving these images, but users on iOS don't see the issue. This suggests it's something to do with the way the Signal App on Android is parsing orientation data. When receiving images from users on older iPhones we don't see the issue on Android.

I've not been through with the debugger yet but read through what I think are the relevant bits of code..

Version: 5.22.8

This line in ZoomingImageView sets the orientation mode to be set from EXIF data: https://github.com/signalapp/Signal-Android/blob/v5.22.8/app/src/main/java/org/thoughtcrime/securesms/components/ZoomingImageView.java#L69

The image dimensions are over 2048 px in height and so subsampling is used: https://github.com/signalapp/Signal-Android/blob/v5.22.8/app/src/main/java/org/thoughtcrime/securesms/components/ZoomingImageView.java#L108

This calls setImage on the SubsamplingImageView: https://github.com/signalapp/Signal-Android/blob/v5.22.8/app/src/main/java/org/thoughtcrime/securesms/components/ZoomingImageView.java#L131

I'm not really sure what goes wrong next.. it must be possible to calculate the correct orientation as it is correct in the thumbnail. When I get some time I'll attach the debugger to see what's happening after this point but if anyone else has time before and is interested then feel free to pick it up

NicolasCGN commented 2 years ago

I can reproduce it!

I only need to make a landscape picture (stock camera app) with the rear camera of the iPhone by holding the bottom part of the iPhone on my left (the rear camera will then be seen on the lower left side of the iPhone for a person being photographed). If I send the picture afterwards directly through the Signal app (and not through the sharesheet, Android users see the picture upside down when showing it in full screen.

Log of Android recipient: https://debuglogs.org/37178423a62b31b0222c59b1b43dbc480398d4984d537850ebb2eb7be413987a

message id: 1634922896642

Screenshots: 442172B1-19A0-4081-B96D-92F20FC456AC BAA9E516-6BCB-4306-951D-26BEFB48B325

Geblaat commented 2 years ago

A contact of mine on Android also gets the image rotated 90 degrees when I take the picture directly from the Signal app (iPhone 12).

artnc commented 2 years ago

I've just opened PR #11881 to fix this :crossed_fingers:

DeRusGAMING commented 1 month ago

I still experience this issue on V7.10.3 I can't send picture I experience this with due to privacy concerns. When I download it and reupload it still has the issue, however if I download it and edit it in any way the issue gets gone.

artnc commented 1 month ago

My fix above is still intact in this repo but yes, the bug also started reappearing again for me at some point in the intervening 2.5 years 🙁