Wrong picture orientation on Samsung devices
See original GitHub issueHi,
After taking a picture with this library I create a Bitmap and set it in an ImageView as follow:
public void onPictureTaken(CameraView cameraView, byte[] data) {
Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
imageView.setImageBitmap(bitmap);
}
This works fine on a Nexus 5X, however on Samsung devices the picture orientation appears to be incorrectly rotated 90 degrees to the left when the device orientation is portrait. Is there a way to fix this issue?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:18
- Comments:25 (1 by maintainers)
Top Results From Across the Web
How to auto rotate or fix screen rotation on your Galaxy phone
1 Swipe down twice from the top of the screen to open your quick settings · 2 Tap Portrait or Landscape to turn...
Read more >Samsung S10 - photos show wrong EXIF-orientation ...
Lot of phones do ths. Change photo viewer, which rotate images with exif information. Reply Reply with quote Reply to thread ...
Read more >SOLVED: Auto-Rotate Not Working On Samsung - YouTube
The main job of the Accelerometer Sensor in a Samsung device is to tell Android OS whether the screen should be in Portrait...
Read more >Android camera/picture orientation issues with Samsung ...
Yes, a malicious user could quickly rotate the device to landscape and back, and you will report wrong orientation. But the camera sets...
Read more >How to Fix It When Android Screen Won't Rotate - Lifewire
Turn on Auto rotate. · Don't touch the screen. · Restart your Android phone. · Allow Home screen rotation. · Update your Android....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I don’t think this is a issue with the library anymore, the application should be in charge of rotating the image if necessary by reading the image Exif data. This can be easily achieved using the new Exif support library
The exif library allows you to easily find out how much you have to rotate the image before you display it to the user. This is how it could be done:
I think this issue can be closed now.
Solved on Samsung and sony devices (tested devices).
I’ve solved this issue by checking if the width > height of the image then rotate by 90
then I call this method to apply the rotation if needed
the reason why I set scale by (-1,1) because I use front camera and need to fix the refliction issue of camera.
hope this solves the issue you have.