You can use the Canvas API for this. Please note that you need to switch the width and height.
final int width = landscapeBitmap.getWidth(); final int height = landscapeBitmap.getHeight(); Bitmap portraitBitmap = Bitmap.createBitmap(height, width, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(portraitBitmap); c.rotate(90, height/2, width/2); c.drawBitmap(landscapeBitmap, 0,0,null); portraitBitmap.compress(CompressFormat.JPEG, 100, stream);
source share