{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/pdf.js/issues/5610","labels_url":"https://api.github.com/repos/mozilla/pdf.js/issues/5610/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/pdf.js/issues/5610/comments","events_url":"https://api.github.com/repos/mozilla/pdf.js/issues/5610/events","html_url":"https://github.com/mozilla/pdf.js/pull/5610","id":53258469,"number":5610,"title":"Better thumbnail image scaling","user":{"login":"fkaelberer","id":4624768,"avatar_url":"https://avatars.githubusercontent.com/u/4624768?v=3","gravatar_id":"","url":"https://api.github.com/users/fkaelberer","html_url":"https://github.com/fkaelberer","followers_url":"https://api.github.com/users/fkaelberer/followers","following_url":"https://api.github.com/users/fkaelberer/following{/other_user}","gists_url":"https://api.github.com/users/fkaelberer/gists{/gist_id}","starred_url":"https://api.github.com/users/fkaelberer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fkaelberer/subscriptions","organizations_url":"https://api.github.com/users/fkaelberer/orgs","repos_url":"https://api.github.com/users/fkaelberer/repos","events_url":"https://api.github.com/users/fkaelberer/events{/privacy}","received_events_url":"https://api.github.com/users/fkaelberer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mozilla/pdf.js/labels/1-viewer","name":"1-viewer","color":"DDDDDD"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-02T15:34:32Z","updated_at":"2015-01-02T18:53:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mozilla/pdf.js/pulls/5610","html_url":"https://github.com/mozilla/pdf.js/pull/5610","diff_url":"https://github.com/mozilla/pdf.js/pull/5610.diff","patch_url":"https://github.com/mozilla/pdf.js/pull/5610.patch"},"body":"```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. \r\n\r\nThis 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. \r\n\r\nThe 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.\r\n![output_ghu1jf](https://cloud.githubusercontent.com/assets/4624768/5597085/94454940-929c-11e4-921b-81e5bd622d45.gif)"},"comment":{"url":"https://api.github.com/repos/mozilla/pdf.js/issues/comments/68551351","html_url":"https://github.com/mozilla/pdf.js/pull/5610#issuecomment-68551351","issue_url":"https://api.github.com/repos/mozilla/pdf.js/issues/5610","id":68551351,"user":{"login":"timvandermeij","id":1993262,"avatar_url":"https://avatars.githubusercontent.com/u/1993262?v=3","gravatar_id":"","url":"https://api.github.com/users/timvandermeij","html_url":"https://github.com/timvandermeij","followers_url":"https://api.github.com/users/timvandermeij/followers","following_url":"https://api.github.com/users/timvandermeij/following{/other_user}","gists_url":"https://api.github.com/users/timvandermeij/gists{/gist_id}","starred_url":"https://api.github.com/users/timvandermeij/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timvandermeij/subscriptions","organizations_url":"https://api.github.com/users/timvandermeij/orgs","repos_url":"https://api.github.com/users/timvandermeij/repos","events_url":"https://api.github.com/users/timvandermeij/events{/privacy}","received_events_url":"https://api.github.com/users/timvandermeij/received_events","type":"User","site_admin":false},"created_at":"2015-01-02T18:53:55Z","updated_at":"2015-01-02T18:53:55Z","body":"@fkaelberer That looks much, much better. 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 that page and reload the viewer, then that thumbnail is nice and the other ones are darker. Any idea what causes that?\r\n\r\n![naamloos](https://cloud.githubusercontent.com/assets/1993262/5598568/13dc1582-92b9-11e4-9243-b5f0d88ecfe6.png)\r\n"}}