Rotate a saved bitmap in android

后端 未结 5 1004
终归单人心
终归单人心 2020-12-05 12:11

I am saving an image from the camera that was in landscape mode. so it gets saved in landscape mode and then i apply an overlay onto it that too is in landscape mode. I want

5条回答
  •  不思量自难忘°
    2020-12-05 13:10

    Check this

    public static Bitmap rotateImage(Bitmap src, float degree) 
    {
            // create new matrix
            Matrix matrix = new Matrix();
            // setup rotation degree
            matrix.postRotate(degree);
            Bitmap bmp = Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), matrix, true);
            return bmp;
    }
    

提交回复
热议问题