List of utility methods to do Bitmap Rotate
Bitmap | fixBitmapOrientation(Uri uri, Bitmap bmp) fix Bitmap Orientation ExifInterface ei = new ExifInterface(uri.getPath()); int orientation = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: return rotateBitmap(bmp, 90); case ExifInterface.ORIENTATION_ROTATE_180: return rotateBitmap(bmp, 180); ... |
Bitmap | rotate(Bitmap b, int degrees) rotate return rotateAndMirror(b, degrees, false);
|
Bitmap | rotate(Bitmap bitmap, int degree) rotate int w = bitmap.getWidth(); int h = bitmap.getHeight(); Matrix mtx = new Matrix(); mtx.postRotate(degree); Bitmap rotatedBitmap = Bitmap.createBitmap(bitmap, 0, 0, w, h, mtx, true); bitmap.recycle(); return rotatedBitmap; ... |
Bitmap | rotateAndMirror(Bitmap b, int degrees, boolean mirror) rotate And Mirror if ((degrees != 0 || mirror) && b != null) { Matrix m = new Matrix(); if (mirror) { m.postScale(-1, 1); degrees = (degrees + 360) % 360; if (degrees == 0 || degrees == 180) { m.postTranslate(b.getWidth(), 0); } else if (degrees == 90 || degrees == 270) { ... |
Bitmap | rotateBitmap(Bitmap b, int degrees) rotate Bitmap if (degrees != 0 && b != null) { Matrix m = new Matrix(); m.setRotate(degrees, (float) b.getWidth() / 2, (float) b.getHeight() / 2); try { Bitmap b2 = Bitmap.createBitmap(b, 0, 0, b.getWidth(), b.getHeight(), m, true); if (b != b2) { ... |
Bitmap | rotateBitmap(Bitmap source, float angle) rotate Bitmap Matrix matrix = new Matrix(); matrix.postRotate(angle); return Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, true); |
Bitmap | rotateBitmap(Bitmap source, int rotation, boolean recycle) rotate Bitmap if (rotation == 0) return source; int w = source.getWidth(); int h = source.getHeight(); Matrix m = new Matrix(); m.postRotate(rotation); Bitmap bitmap = Bitmap.createBitmap(source, 0, 0, w, h, m, true); if (recycle) ... |
Bitmap | rotatePic(Bitmap bitmap, int degree) rotate Pic Matrix matrix = new Matrix(); matrix.postRotate(degree); int width = bitmap.getWidth(); int height = bitmap.getHeight(); return Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true); |
Bitmap | rotation(Bitmap source, int degrees) rotation if (null == source || source.isRecycled()) { return null; Matrix matrix = new Matrix(); matrix.postRotate(degrees); Bitmap rotation = Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, true); if (rotation != null) { ... |
Bitmap | GetRotatedBitmap(Bitmap bitmap, int degrees) Get Rotated Bitmap if (degrees != 0 && bitmap != null) { Matrix m = new Matrix(); m.setRotate(degrees, (float) bitmap.getWidth() / 2, (float) bitmap.getHeight() / 2); try { Bitmap b2 = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m, true); if (bitmap != b2) { ... |