Skip to content

Commit

Permalink
rotate preview images so they are vertical
Browse files Browse the repository at this point in the history
  • Loading branch information
n8fr8 committed Aug 9, 2017
1 parent 593ce54 commit b2defa1
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.ImageFormat;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.YuvImage;
import android.os.Environment;
Expand Down Expand Up @@ -116,6 +117,11 @@ public void run() {

byte[] imageBytes = baos.toByteArray();
rawBitmap = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length);
// Setting post rotate to 90
Matrix mtx = new Matrix();
mtx.postRotate(-90);
// Rotating Bitmap
rawBitmap = Bitmap.createBitmap(rawBitmap, 0, 0, width, height, mtx, true);
}
else
{
Expand Down

0 comments on commit b2defa1

Please sign in to comment.