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

Use linear RGB downscaling for most/some downscaling operations. #61

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

awused
Copy link

@awused awused commented Nov 27, 2021

Didn't include nearest_aligned since it shouldn't matter when there's no blending of pixels going on.

This is a pretty minimal, targeted change, and it's also really poorly tested since I've only run it locally myself without testing a wide range of settings or inputs. I am also certainly missing some places where downscaling can happen, but these seem to be the places used during OTF augmentations for my config and I didn't want to make a very invasive change to an unfamiliar Python codebase.

Probably not ready to merge, but probably usable by people who want to apply it locally.

@awused awused force-pushed the linear branch 2 times, most recently from 565128d to bc7db1f Compare November 27, 2021 11:18
Didn't include nearest_aligned since it shouldn't matter when there's no blending of pixels going on.
@awused
Copy link
Author

awused commented Nov 30, 2021

Since the nearest neighbour implementation is using blending it should also be done in linear RGB, and I was able to replicate the same problems from the bug report.

if (w <= h and w == size) or (h <= w and h == size):
return img
img = srgb2linear(img)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell this resize() function can be entered both inside of another converted block. It's probably best to just introduce wrapper types to avoid double conversions anywhere.

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

Successfully merging this pull request may close these issues.

1 participant