Skip to content

Instantly share code, notes, and snippets.

@Maxim-Kolmogorov
Created August 15, 2022 10:00
Show Gist options
  • Save Maxim-Kolmogorov/971d1c291ec45b1fbe07ee04a359526d to your computer and use it in GitHub Desktop.
Save Maxim-Kolmogorov/971d1c291ec45b1fbe07ee04a359526d to your computer and use it in GitHub Desktop.
Android rotate photo 90f.
private val mPicture = Camera.PictureCallback { data, _ ->
val myBitmap: Bitmap = BitmapFactory.decodeByteArray(data, 0, data.size)
// Rotate image
val matrix = Matrix()
matrix.postRotate(90f)
val rotatedBitmap = Bitmap.createBitmap(myBitmap, 0, 0, myBitmap.width, myBitmap.height, matrix, true)
// Ready, but before please init var viewPhoto: ImageView
// viewPhoto.setImageBitmap(rotatedBitmap)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment