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

Update default interpolation mode. #1734

Closed
wants to merge 1 commit into from
Closed

Conversation

siblount
Copy link
Contributor

Closes #1716
Closes #1701

For images that are upscaled, the interpolation mode should be at a higher quality. Since we now use GPU, we can set the max to High Quality Bicubic as the default.
This pull request changes When zoom > 100% to High quality bicubic.

For images that are downscaled, there is less need for high-quality interpolation since the details are being lost due to the downscale, I set it to Nearest Neighbor but Linear will also be an appropriate option.

@d2phap
Copy link
Owner

d2phap commented Nov 28, 2023

Thanks for the PR! I already fixed it by always using NearestNeighbor for 100% scale.

  • When zoom > 100%, the default interpolation should be NearestNeighbor, it's easier for picking color. It's also similar to photo editor apps.
  • Using MultiSampleLinear for zoom < 100% is the most optimal:

D2D1_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR
Uses 4 linear samples within a single pixel for good edge anti-aliasing. This mode is good for scaling down by small amounts on images with few pixels.

@d2phap d2phap closed this Nov 28, 2023
@vaisest
Copy link

vaisest commented Nov 28, 2023

Are you sure linear for downscaling is actually better? Linear seems to produce much more aliased results. Imagemagick has a large amount of documentation on this and their default filter is Lanczos3, which is much less sharp.

@d2phap
Copy link
Owner

d2phap commented Nov 28, 2023

D2D1_INTERPOLATION_MODE does not contain Lanczos3. Considering between quality and performance, D2D1_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR is the best fit:
https://learn.microsoft.com/en-us/windows/win32/api/d2d1_1/ne-d2d1_1-d2d1_interpolation_mode#constants

This is the default setting, user can always change it.

@siblount
Copy link
Contributor Author

@d2phap sweet!

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