Just be careful with the raster type from the Java platform call, like from the answers of comm1x and Gnzlt , because it can return zero . I think this is also more flexible if the parameter can be any number and use the infix for readability, depending on your coding style.
infix fun Bitmap.rotate(degrees: Number): Bitmap? { return Bitmap.createBitmap( this, 0, 0, width, height, Matrix().apply { postRotate(degrees.toFloat()) }, true ) }
How to use?
bitmap rotate 90 // or bitmap.rotate(90)
HendraWD Apr 02 '19 at 17:13 2019-04-02 17:13
source share