Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image.resize() biases first row+column in all interpolation modes #24733

Open
nobuyukinyuu opened this issue Jan 3, 2019 · 2 comments
Open

Comments

@nobuyukinyuu
Copy link
Contributor

nobuyukinyuu commented Jan 3, 2019

Godot version:
3.0.6

Issue description:
See video.
https://cdn.discordapp.com/attachments/477544613511692358/530275849467985920/2019-01-03_00-46-04.mp4

When trying to help someone with a problem they were having with creating an "average" of a few pixels from a viewport texture (by resizing the raw image data to 1x4), they noticed that the output values were not what they expected. I wrote a test program to see if I could understand what was going on and noticed that as an image is sized down, there appears to be an increasing bias on the leading edge pixels towards what the averaged output would be. This seems to apply regardless of the interpolation method used.

It should be noted that even in "uneven" sized images (not power of 2) this also seems to happen. I tested this with an image with a small amount of alpha 0 in the corner. Eventually, the leading edge on both axes continues to approach a total bias on the interpolated average as the final image size approaches 1 pixel. In the case of the test with the 0-alpha pixel at the first row and column, this meant that an image resized to 2x2 would have 3/4 of its area blank.

Attached is the demo project.

Minimal reproduction project:
MinimalResizeBug.zip

@Calinou
Copy link
Member

Calinou commented Aug 18, 2020

@nobuyukinyuu Can you (or anyone else) still reproduce this bug in Godot 3.2.2 or any later release?

If yes, please ensure that an up-to-date Minimal Reproduction Project (MRP) is included in this report (a MRP is a zipped Godot project with the minimal elements necessary to reliably trigger the bug). You can upload ZIP files in an issue comment with a drag and drop.

@nobuyukinyuu
Copy link
Contributor Author

Confirmed still replicable in Godot 3.2.2. The demo still runs without modifications. Sweep the mouse cursor left and right to demonstrate the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants