Reversed Height and Width when optimizing a large image with Ratio > 1
Stray216 opened this issue ยท 5 comments
Bug description
When uploading an image, if the ratio is > 1 and the image is too large and needs optimizing, the height and width become reversed, causing the image to look squished.
Steps to reproduce the issue
- Using the camera, upload an image that has a height more than 1920px
- Height and width have been reversed and the output image looks squished
Expected behavior
Height and width of the final image shouldn't have been reversed and the aspect ratio should stay the same
Log files
idk how to find log files, sorry
Versions
- MC Version: 1.16.5
- Forge Version: 36.0.42
- Mod Version: 1.0.3
Other mods
No other mods. This was tested with just this mod alone.
Screenshots
https://imgur.com/a/BleT3zM (1 input image, 2 in minecraft, 3 output image)
Apparently i've been looking in the wrong section of the if-statement, in line 90 of ImageTools.java you multiply by the ratio (more than 1) which makes the width larger than 1920, which is the height, making the image squished. What i think you need to do is divide by the ratio.
newWidth = ((int) (((float) MAX_IMAGE_SIZE) / ratio));
here you go https://imgur.com/a/BleT3zM
i've added the actual output image to the album