-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Switch default interpolator to bicubic, improve speed/quality of binlinear (was: Documentation: interpolateWith) #289
Comments
Hello, yes this has come up a few times recently. A few other options could be:
|
Only use gaussian blur for non-linear interpolators Improves performance of bilinear by ~15% Add liborc to the packaged build to improve bicubic perf Add examples of the various interpolation methods Add bilinear vs bicubic to perf tests
Commit 84fd1ca implements option 3. This brings a slight performance reduction for the default |
The |
@lovell just found this issue. Sorry if my question looks stupid. A there any reasons to not support lanczos3 filter for resize? Any better alternatives? When implementing https://github.com/nodeca/pica, i've seen another list of presets in chromium skia (by speed):
I'm not saying anything good or bad about algorythms, just try to understand relation between names and quality for common use. |
@puzrin Hi Vitaly, when downsampling/reducing, sharp always applies a small Gaussian blur prior to using the selected interpolator, which I believe is approximately equivalent to using a Lanczos 2 filter. This means sharp's default behaviour should be close to *magick's default Lanczos settings. I've read somewhere that Lanzcos 3 can increase acutance/haloing when downsampling, but this probably depends on the input image, e.g. for text-as-an-image this may be a good thing. Perhaps a measure of entropy within an image could be used to select 2 vs 3, with a lower entropy favouring 3 over 2. There are people who have spent a lifetime more than me studying filters and interpolators and image resizing in general. If you'd like to know more then please do ask this question over at the libvips repo. The current plan is to switch sharp to the recently-improved As an (important) aside, thank you for helping to maintain the excellent js-yaml module. I was using it only last week, demoing its support for private types to some oblivious-then-envious Java-centric developers. |
@lovell I'm familiar with situation about hudge number of filters for different needs. Agree that blur + bicubic resampling gives similar result. Problem with this method is, that it contains "magical numbers" and those should vary on scale. Without statistics such euristic is not very cool. Pure lanczos3 is more predictable from the mathematical point of view. AFAIK, lanczos3 is more common for downscale (+ unsharp mask after), and bilinear vs bicubic are popular only as start point because of simple implementation. I did't wished to create a new ticket about, because i'm not familiar how deep did you digged this topic before and i don't know your reasons to select blur + bicubic. But if you need any help - i'm ready to share everything i learned while writing |
Maybe it makes sense to mention in the documentation more clearly that:
bilinear
interpolation is default interpolatorbilinear
is not always suitable for reducing the size of imagesbicubic
usually provides better quality of reduced imagesThe text was updated successfully, but these errors were encountered: