-
-
Notifications
You must be signed in to change notification settings - Fork 261
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
Correctly rotate and flip image using Exif attributes. #443
Conversation
|
||
return when (bitmap) { | ||
null -> RotateBitmapResult(null, degrees, flipHorizontally, flipVertically) | ||
else -> RotateBitmapResult(rotateAndFlipBitmapInt(bitmap, degrees, flipHorizontally, flipVertically), 0, false, false) |
Check warning
Code scanning / detekt
Line detected that is longer than the defined maximum line length in the code style.
} | ||
} catch (ignored: Exception) { | ||
fun orientateBitmapByExif(bitmap: Bitmap?, context: Context, uri: Uri): RotateBitmapResult { | ||
val exifInterface = context.contentResolver.openInputStream(uri)?.use { ExifInterface(it) } |
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.
Now we close every single time just like in #440
|
||
return when (bitmap) { | ||
null -> RotateBitmapResult(null, degrees, flipHorizontally, flipVertically) | ||
else -> RotateBitmapResult(rotateAndFlipBitmapInt(bitmap, degrees, flipHorizontally, flipVertically), 0, false, false) |
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.
calling rotateAndFlipBitmapInt
is the fix and once we've flipped and rotated we no longer need to rotate / flip hence 0, false, false
Hmm seems like cropping afterwards is broken. Will need to dig a bit further |
I've tried but I gave up for now. The moment I change something, another feature breaks. It seems like everything is calibrated to behave on certain not so true data. For the time being, I'll just copy what's inside |
This should already be good to go right? |
Unfortuantely not. The cropping logic which crops the image after you've resized / rotated ect relies on the broken image and when fixing it and rotating it, like I've done here the output is just wrong. I haven't had time to look into this yet plus I've got my workaround which seems to be working. |
I'll get back to it in the future. |
Fixes #439