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

option to configure resampling filter for thumbnail generation #12

Closed
specterpete opened this issue Apr 1, 2019 · 6 comments
Closed

Comments

@specterpete
Copy link

Thumbnails are currently generated with imaging using the Lanczos resampling filter. This filter is the most resource-consuming, especially on low performance devices like raspberry pi this results in slow thumbnail generation.

I suggest to add a config option to configure the resampling filter (NearestNeighbor, Box, Linear, Hermite, MitchellNetravali, CatmullRom, BSpline, Gaussian, Lanczos, Hann, Hamming, Blackman, Bartlett, Welch, Cosine) so that thumbnail generation can be optimized towards the platform used.

@midstar
Copy link
Owner

midstar commented Apr 2, 2019

Thank you very much for you feedback. I created a new test case, TestGenerateImageThumbnailPerformance, that generates thumbnails with different resampling filters on following branch:

 feature/imaging-resampling-filter

Unfortunately I don't see much performance gain on my ROCK64 SBC nor my Windows PC (see test results below). The quality is quite similar using all the filters except "NearestNeighbor" which has really bad quality. I suggest we simply change the resampling filter from Lanczos to Box since this is the fastest filter with, in my opinion, acceptable quality.

What do you think about that?

Filter Rock 64 Windows PC
Lanczos 2998 ms 622 ms
CatmullRom 2876 ms 641 ms
MitchellNetravali 2884 ms 632 ms
Linear 2708 ms 555 ms
Box 2647 ms 532 ms
NearestNeighbor 2548 ms 520 ms

@specterpete
Copy link
Author

Sounds fine to me. I expected more difference. Thanks for testing it out.

@specterpete specterpete reopened this Apr 2, 2019
@specterpete
Copy link
Author

Accidentally closed, sry.

@specterpete
Copy link
Author

This might also be of interest https://github.com/fawick/speedtest-resize/blob/master/README.md

@midstar
Copy link
Owner

midstar commented Apr 4, 2019

That link was not any happy reading for me who prefer a pure golang imaging library ;-)

If we implement #11 the speed of thumbnail generation might not be that big of an issue.

@midstar
Copy link
Owner

midstar commented Apr 21, 2019

Resampling filter was changed from Lanczos to Box in following release:

https://github.com/midstar/mediaweb/releases/tag/mediaweb-v1.0.0.132

@midstar midstar closed this as completed May 22, 2019
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

No branches or pull requests

2 participants