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

Improve downscale #720

Merged
merged 7 commits into from
Apr 17, 2018
Merged

Improve downscale #720

merged 7 commits into from
Apr 17, 2018

Conversation

kaj
Copy link
Member

@kaj kaj commented Feb 4, 2018

When scaling images down, the support pixels was counted before scaling, so only a small part of the pixels that should contribute actually did contribute, giving rough edges and moire aliasing problems. Here are some down-scaled sample images scaled before and after this change.

Also, the Gaussian method used a standard deviation of 1.0, where I think it should use a standard deviation of 0.5, giving a diameter of 1.0 (rather than a radius of 1.0) for the main contributing area. Here are some up-scaled smaple images before and after, note the blurry images for gaussian scale before the change.

Also, I added an integer-only thumbnail method for fast down-scaling.

(Writing this message, I realize I should probably have made this three separate PRs. Sorry.)

The floating point "size" used for nearest should be 0, not 0.5.  Fix
clamping so at least one source pixel is used sampled for each output
pixel, but also so the floating point "size" applies to source size.

I'm not too sure of this for scaling UP, but for scaling _down_ it
seems more or less right.
Fast integer-only downscaling.
@bvssvni
Copy link
Contributor

bvssvni commented Apr 15, 2018

Looks good to me.

@bvssvni
Copy link
Contributor

bvssvni commented Apr 17, 2018

Merging.

@bvssvni bvssvni merged commit 529ad81 into image-rs:master Apr 17, 2018
@bvssvni
Copy link
Contributor

bvssvni commented Apr 17, 2018

Thanks!

kaj added a commit to kaj/image that referenced this pull request Apr 18, 2018
Use resize_dimensions from PR image-rs#667 in thumbnail from PR image-rs#720.
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.

None yet

3 participants