I have a rectangle bitmap that I need to rotate 90 degrees clockwise or counterclockwise.
I can make a rotation using this code:
Matrix matrix = new Matrix();
matrix.setRotate(90, originalBitmap.getWidth()/2, originalBitmap.getHeight()/2);
return Bitmap.createBitmap(originalBitmap, 0, 0, originalBitmap.getWidth(), originalBitmap.getHeight(), matrix, true);
However, this code rotates the image "in place" using the old values ββfor height / width. And the resulting image looks stretched and ugly.
Is there a good way to rotate an image 90 degrees to a new height / width? Perhaps one possible solution is to resize the original bitmap first?
thank
Anton source
share