[Android] Image rotated 90 degrees
See original GitHub issueI am using ImagePicker.showImagePicker
to take a photo. iOS outputs a correctly orientated image. On Android, the image is rotated 90 degrees. I am taking a picture using a Google Pixel API 25 Simulator. The simulator is in portrait mode.
This is the relevant part of response
{
height: 480,
isVertical: true,
originalRotation: 0,
width: 640
}
isVertical: true
but the height
and width
are switched (so rotated 90 degrees).
Issue Analytics
- State:
- Created 6 years ago
- Reactions:25
- Comments:30 (1 by maintainers)
Top Results From Across the Web
Android: Rotate image in imageview by an angle
As of API 11, you can set the absolute rotation of an ImageView programmatically by using the imageView.setRotation(angleInDegrees); method. By absolute, I mean ......
Read more >How to Rotate Photos on Android Phone or Tablet - Techbout
A single tap on the Rotate icon rotates the Photo by 90 degrees and you can keep tapping to Rotate more, until the...
Read more >How to Rotate an Image to a Certain Angle in Android?
Navigate to the app > res > layout > activity_main.xml and add the below code to that file. Below is the code for...
Read more >How To Fix The Camera Intent Rotated Image In Android
Scale down the image if it was bigger than 1024×1024. · Rotate the image to the right orientation only if it was rotated...
Read more >5 Best Free Apps to Rotate Images in 2022 [iOS & Android]
PhotoDirector has an easy-to-find, and simple-to-use rotate tool. The image will rotate 90 degrees with each tap for quick and easy rotation ......
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 FreeTop 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
Top GitHub Comments
Hope this helps. Setting
rotation: 360
worked for me.Image-picker’s “original” / default image config causes this bug.
Overriding the default config is not so straight forward because this library ignores some image configurations. https://github.com/react-community/react-native-image-picker/blob/694fa1de5cf4a3dce8e135054c3831fba85e3880/android/src/main/java/com/imagepicker/media/ImageConfig.java#L139
So, if you only set
rotation: 0
, the image on Android will get rotated 90 degrees because image-picker will continue to use the default image config. If, however, you setrotation: nonZeroInteger
, image-picker will respect your configuration – setting rotation to 360 will preserve the orientation. If you don’t setrotation
and just setquality: 0.99
(I would not suggest doing this), image-picker will also respect your config – not rotate and reduce the quality by 0.01.@JonoH your solution works for me. Although one thing to note is that when taking images with the front camera (selfie), the rotation is 270.
Hence here is what I ended up with in case it helps someone: (react-native-image-picker + react-native-image-resizer)