-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Better thumbnail image scaling #5610
Better thumbnail image scaling #5610
Conversation
@fkaelberer That looks much better than before! I have only found that it isn't applied to all thumbnails, but mostly only for the currently active page and maybe the next one. See the screenshot I took below. You can see that the first two are very nice, but the other two are rather dark. If I go to one of the pages with a dark thumbnail and reload the viewer, then that thumbnail is nice and the other ones are darker. Any idea what causes that? |
@timvandermeij That issue is already present in master. The difference should be that the first two thumbnails are created using the page canvas, while the others are actually rendered. |
Correct, in the future we can try rendering on the canvas 2x larger and scale down to the target size. |
In that case ignore my comment. Sorry for the noise! |
this can be merged right? The thumbnail looks indeed better and the PR does not change anything besides the manual downscaling order. |
Some thumbnail regressions have been found. See #5637 for all details. While this PR does not have anything to do with those, it magically fixes one of them (the stretching issue). We're not yet sure why (or why the other two commits caused the regressions in the first place). |
Regressions have been fixed. /botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/0360358bbda8c19/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/0360358bbda8c19/output.txt Total script time: 0.82 mins Published |
Better thumbnail image scaling
Really nice, thank you! |
Better thumbnail image scaling
ctx.drawImage()
does a bad job scaling large image onto a small canvas (results are very noisy/blocky). Therefore, images are scaled down by factor 2 several times before the image is scaled to thumbnail canvas size.This PR changes the order of scaling factors: It first scales by a fractional value, and then scales down by 2 several times. Scaling by fractional numbers usually introduces more artifacts (e.g. blurryness) than scaling by powers of 2. The resulting image quality is higher because the artifacts of fractional scaling are introduced in the first scaling step, and then than vanish when downsampling by exact powers of 2 afterwards.
The following animated gif toggles the thumbnail images which are generated with new and old code from the tracemonkey paper at 70%, 100%, 180% and 300% zoom.
