rotate Bitmap Image - Android android.graphics

Android examples for android.graphics:Bitmap Operation

Description

rotate Bitmap Image

Demo Code

import android.graphics.Bitmap;
import android.graphics.Matrix;

public class Main {

  public static Bitmap rotateImage(Bitmap img, int degree) {
    Matrix matrix = new Matrix();
    matrix.postRotate(degree);//from  w w w  .  jav  a 2  s.  com
    Bitmap rotatedImg = Bitmap.createBitmap(img, 0, 0, img.getWidth(), img.getHeight(), matrix, true);
    // img.recycle();
    return rotatedImg;
  }

}

Related Tutorials