Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem:
Application is opening some images incorrectly. The image is being rotated incorrectly and the wrong heights/widths are being used for scaling.
For example, this image with a Width of 4096 pixels and Height of 3072 pixels and an orientation of upper-right was showing like this:
![image](https://private-user-images.githubusercontent.com/11878115/410172865-fc1cd8c5-99cc-4bd8-be04-8a7996e34c06.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNjc3NDAsIm5iZiI6MTczOTA2NzQ0MCwicGF0aCI6Ii8xMTg3ODExNS80MTAxNzI4NjUtZmMxY2Q4YzUtOTljYy00YmQ4LWJlMDQtOGE3OTk2ZTM0YzA2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA5VDAyMTcyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdiM2RmYjYxZDVmZjAzZjMxMzRkZGJkMmMyYzA1MjU5Y2ExMzE4MTljZTFkMGZhNGMyZTBhNDY1YjE4ZmYyNjkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.MiWImT4SU__axIGsupWm-Kt5ddBhQC2nDdpxup5746k)
My screen size is 1080x2460
It appears after BitmapUtils.decodeSampledBitmapFromFile() is run, that the orientation is changed successfully.
The problem then was the height/width used. When originally using my screen size, the scaling was affected by stretching the image to fit the height of my screen. It needs to maintain the original aspect ratio of the image.
The image was then being rotated again, thus resulting in the image above.
Solution:
Take original heights and widths of file.
Determine if this image is to be rotated 90 or 270 degrees. If so, the height and width needs to accommodate for that.
Now, decode the bitmap using the original image's height/width.
Next, scale the image based on your screen size.