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
fix(exif-orientation): added support for exif values 2, 4, 5 and 7 #409
Conversation
@Canato heya, I thinks this PR should do the trick to resolve my issue from a couple hours ago |
exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL) | ||
val degrees: Int = when (orientationAttributeInt) { | ||
ExifInterface.ORIENTATION_ROTATE_90, ExifInterface.ORIENTATION_TRANSVERSE, | ||
ExifInterface.ORIENTATION_TRANSPOSE -> 90 |
Check warning
Code scanning / detekt
Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just an enum, mr bot, dont you worry
@Mouwrice on the steps to reproduce could you provide an image for testing and which buttons are you clicking(and the order)? Not sure if I was able to reproduce |
@Canato Of course: https://github.com/recurser/exif-orientation-examples To reproduces just open the app, The exact images used in my PR description are: The other EXIF values caused no issues, as you had already taken them into account. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not reproduce it, but the code looks very nice and the new version is all good!
Thanks for the improvement
@Canato Thanks you and you are welcome. Do you have any ETA for when this will get release into a new version. I am kind off in urgent need for this fix. Also, are you sure you tried it on the main branch with the images supplied and not this branch (which no longer has the issue of course) hahahah :p |
@Mouwrice the CI passing we merge and release a fix today. I'm going to Tomorrowland tomorrow and back next Wednesday, so is time for it XD |
oooooh, hahahahah have fun! I want to go too someday |
Closes #408
Bug
Cause:
The BitMapUtils did not take all EXIF orientation values into account causing some images to show mirrored and rotated wrongly.
Reproduce
GIVEN: An image with an EXIF value of 2, 4, 5 or 7
WHEN: Opening the image in the crop view
THEN: Images have the wrong orientation
How the bug was solved:
Added the remaining of the
ORIENTATION
tags from theExifInterface
https://developer.android.com/reference/androidx/exifinterface/media/ExifInterface#TAG_ORIENTATIONBefore:
After: