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 resize kernel docs and expose missing (bi)linear kernel #4061

Closed
einarakerlind opened this issue Apr 9, 2024 · 3 comments
Closed

Comments

@einarakerlind
Copy link

Question about an existing feature

What are you trying to achieve?

I noticed that i get identical results for all kernels except nearest when upscaling an image. Is this expected behaviour?
Version: 0.33.3

When you searched for similar issues, what did you find that might be related?

Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this question

sharp("path-to-image/example.png").resize({ width: 600, height: 600, background: { alpha: 0, r: 0, g: 0, b: 0 }, kernel: 'lanczos2' });

Please provide sample image(s) that help explain this question

example
Original image

example-600-cubic
Scaled using cubic kernel

example-600-l2
Scaled using lanczos2 kernel

@lovell
Copy link
Owner

lovell commented Apr 9, 2024

Yes, the underlying logic that maps downsampling kernels to upsampling interpolators within libvips can be seen at:

https://github.com/libvips/libvips/blob/c2ede6c110ffcdb47606e8366b8f6a5ff7515b76/libvips/resample/resize.c#L113-L132

However this mapping was missing from the sharp documentation, which commit 6257994 addresses (as well as exposing the missing bilinear kernel). Thanks for reporting.

@lovell lovell added this to the v0.33.4 milestone Apr 9, 2024
@lovell lovell changed the title Kernel other than "nearest" has no effect on upscaling? Improve resize kernel docs and expose missing (bi)linear kernel Apr 9, 2024
@einarakerlind
Copy link
Author

Thanks for clarifying!

@lovell
Copy link
Owner

lovell commented May 16, 2024

v0.33.4 now available.

@lovell lovell closed this as completed May 16, 2024
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

2 participants