-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Portait photos rotated 90deg in crop view on Samsung device #4
Comments
I discovered this bug and fixed it a while ago. Maybe sync with the latest version and check again? |
im using the this in gradle: com.yashoid:instacropper:1.0.5 like in the readme, is there a newer version? |
No there is no newer version. This is a real bug. How does it work in these 3 cases:
|
Displays correctly. (if taken in portrait, picture is rotated -90deg)
Displays correctly for pictures taken in landscape. Pictures taken in Portrait is rotated -90deg (counter clockwise)
Displays correctly. |
Any solutions for this? |
I will fix it as soon as I get a time to myself again! I'm gonna need someone to test it for me because I do not have the device to test. It is working fine on my device (Pixel). Is anyone willing to communicate with me more closely so that he/she can test it as I try to fix? |
I can help you test it since its rotated on my device |
I think I managed to fix it. Please check and let me know. Thanks. New version is 1.0.6 |
I am still having the rotation problems with 1.0.6 . I will give you a link to a photo that has the rotation problem (its taken in portrait on samsung s6 edge+) so its easier for you to test it: When i load this image into the cropper its shown rotated -90 degrees. I load it just like this from the gallery picker:
And init the cropper with this:
|
The photo is turned. Even my computer opens it turned. I looked it up and it seems like it is a manufacturer bug. Also follow the code.google.com link in the comment for further information. I have added code that tries to read the orientation data prom the image file itself. But if it isn't present in the image file there is nothing possible to be done on the code side. You probably need to add a rotate button and pass the rotated image URI to InstaCropper view again. |
Just realized your image is valid. Orientation data exists on it. Windows showed it rotated but Photoshop opens is correctly. I'm gonna try fixing further. |
Nice to hear that the image has the data needed! I see it rotated correctly in most places like google photos (web+app), gallery picker, windows image viewer etc. Its good to hear that data is in the image so there is no need for hardcoding manufacturer+phone models for rotation :) |
Hello! Has there been any progress regarding this issue? Thanks |
Hello! After coming across the issue quite a few times in other devices (i.e LG G4), I took a better look at the code and realised that the problem lies within the MakeDrawableTask.java class at the following line of the getRotation(uri, context) method:
which resolves for devices running up to Marshmallow. I couldn't reproduce the issue with newer OS versions such as Nougat, but it kept appearing to older ones. Long story short, just change the above line to:
as the .toString() call generates a path prefixed with "file://" and that doesn't seem to be agreeable with the path's resolution in this case. Furthermore, using only the path-based constructor of the ExifInterface class seems to work for all OS versions and devices; so no real need for the version-check IF. P.S Don't forget to also handle the onBackPressed in you cropping activity - in conjunction with the above - if you are allowing the original image to be fed as a result without 'cropping'. |
When loading InstaCropperView with an image from Samsung device (s6 edge+ in my case) the image shows up rotated 90deg.
The text was updated successfully, but these errors were encountered: