I am developing a project which requires the image crop feature like camscanner android application,when a picture is taken and when user clicks the crop button, a rectangle
thanks @jhansi for this amazing library but the problem of this library(Android Scanner Library) is the image orientation is always 90 degree rotated, we can solve it like this.
Solution in Kotlin
In OnActivityResult it gives you bitmap and this bitmap you can pass to "Bitmap.roate" method.
Use it like this: val rotatedBitmap=bitmap.rotate(90f)
imageView.setImageBitmap(rotatedBitmap)
Paste this method in your activity:
fun Bitmap.rotate(degrees: Float): Bitmap {
val matrix = Matrix().apply { postRotate(degrees) }
return Bitmap.createBitmap(this, 0, 0, width, height, matrix, true)
}