How Can I Rotate Image And Video If It Was Captured In Landscape Mode?
I have an ImageView and VideoView on my screen. My Activity is always in a portrait mode (and i can't rotate it because of another elements). How can i rotate image/video if it
Solution 1:
public Bitmap rotateBitmap(Bitmap source, float angle) {
Matrix matrix = new Matrix();
// Perform matrix rotations/mirrors depending on camera that took the photo
if (cameraCurrentID == Camera.CameraInfo.CAMERA_FACING_FRONT) {
float[] mirrorY = { -1, 0, 0, 0, 1, 0, 0, 0, 1};
Matrix matrixMirrorY = new Matrix();
matrixMirrorY.setValues(mirrorY);
matrix.postConcat(matrixMirrorY);
}
matrix.postRotate(angle);
return Bitmap.createBitmap(source, 0, 0, source.getWidth(),
source.getHeight(), matrix, false);
}
Post a Comment for "How Can I Rotate Image And Video If It Was Captured In Landscape Mode?"