Rotating image in 30, 45,60,75 ,90,120, 180, 270 ,360 degree depend upon angle provided in android. Image rotation in android

Rotating image in 30, 45,60,75 ,90,120, 180, 270 ,360 degree depend upon angle provided in android.
Image rotation in android 
//pass bitmap of image and angle to rotate
 
public static Bitmap RotateBitmap(Bitmap source, float angle) {
    Matrix matrix = new Matrix();
    matrix.postRotate(angle);
    Bitmap rotatedImg = Bitmap.createBitmap(source, 0, 0,
            source.getWidth(), source.getHeight(), matrix, true);
    source.recycle();
    return rotatedImg;

}

Comments

Popular Post

Implement search functionality with help of edittext, rxjava and retrofit 2 in android.

QR code scanner using Zxing library. Scanner for android

Store GPS Location in image background android.

Storing captured image or an image picked from a gallery in internal storage using file provider android.

Shortcut for android for every version, android shortcut for oreo, android shortcut for nougat.