Kotlin Rotate Image (KRI)


KRI:   SOLD       




Hi Dev, this time I'm working on an Android app project to save screen capturing images. When saving it to local storage, the problem doesn't arise, when I open it in the gallery the image looks normal.

But Dev, a problem arose when I uploaded the images to the server, what happened was that randomly and unexpectedly some images were rotated without my consent and without my prior expectation, because the local source files were unmodified and there was no oddity when reviewing them in the gallery app.

The solution I would like to try is to standardize that all images uploaded to the server must be in landscape mode, so is that possible?

Answer: Of course it is very possible, namely by doing something like this.

Matrix matrix = new Matrix();
matrix.postRotate(90F);
Bitmap newBitmap = Bitmap.createBitmap(bitmap,0, 0, bitmap.getWidth(), bitmap.getHeight(),   matrix, true);
imageView.setImageBitmap(newBitmap);
imageView.setBackgroundResource(imageBackground);

Post a Comment

Previous Next

نموذج الاتصال