I am converting each frame retrieved from the camera into a bitmap and i display it on an ImageView, but i found that the imageView contains a rotated bitmap so i wanted to rotate the bitmap 90 degrees to set it right again using this line
matrix.postRotate(90);
now the problem is, when used "matrix.postRotate(90);" the width of the bitmap cahnges and gets smaller as shown in image_1 below. and when i used "matrix.postRotate(0);" i got a bitmap of different width as shown in image_2 below. what i want to do now is, to have the same dimension of the bitmap regardless of the rotation angle applied
please let me know why "matrix.postRotate" chnages the dimesnions of a bitmap and how to solve this issue
code:
//required to rotate the bitmap, because it is initially lopsided
Matrix matrix = new Matrix();
//matrix.postScale(0.01f, 0.01f);
matrix.postRotate(0);
Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
xml: imageView that hosts the bitmap
<ImageView
android:id="@+id/mainActivity_ivEdges"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
image_1: please see the image in the middle
image_2: please see the image in the middle