Camera Mod

Camera Mod

16M Downloads

Reversed Height and Width when optimizing a large image with Ratio > 1

Stray216 opened this issue ยท 5 comments

commented

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

  1. Using the camera, upload an image that has a height more than 1920px
  2. 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)

commented

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));

newWidth = ((int) (((float) MAX_IMAGE_SIZE) / ratio));

commented

Can you send me an example screenshot?

commented

here you go https://imgur.com/a/BleT3zM
i've added the actual output image to the album

commented

Both taking an ingame picture and uploading works fine for me:

2021-02-20_09 03 50

EDIT: Nevermind. Just read that you said OVER 1920

commented

Should be fixed in the next version.