blurry canvas if deviceScaleFactor > 1
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 1.5.0
- Platform / OS version: Mac OS X 10.11.6
- URLs (if applicable):
- Node.js version: 9.4.0
What steps will reproduce the problem?
- Go to https://try-puppeteer.appspot.com/. Use the following code:
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://www.google.de/maps/@52.5197103,13.4068538,16.11z');
await page.setViewport({
width: 800,
height: 600,
deviceScaleFactor: 3
});
await page.waitFor(5000);
await page.screenshot({path: 'screenshot.png'});
await browser.close();
- Check screenshot and compare it against what you can see while browsing https://openlayersbook.github.io/ch06-styling-vector-layers/example-03.html on a retina display device in a real Chrome.
What is the expected result? Sharp canvas.
What happens instead? Blurry canvas.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
blurry canvas if deviceScaleFactor > 1 · Issue #2755 - GitHub
Use the following code: const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto('https://www.google.de/ ...
Read more >Window.devicePixelRatio - Web APIs | MDN
A <canvas> can appear too blurry on retina screens. Use window.devicePixelRatio to determine how much extra pixel density should be added to ...
Read more >Canvas charts is blurry when download as PDF - Stack Overflow
1. Looks like the image dimensions are changed in second image. Blurry might be bcoz the image is stretched. · which jspdf version...
Read more >Fixing HTML5 2d Canvas Blur - Medium
Understand how to use DPI to fix Canvas Blur ... First and foremost, if you've worked with Canvas at all, you'll notice there...
Read more >388908 - text frequently blurry at 1.5x on initial load - chromium
On opening a new page, the font often starts out blurry. ... Not sure if it's a regression yet. ... Labels: -Pri-2 Pri-1...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That looks great to me! We actually got caught on
setContent
, notgoto
, but hopefully someone will either find this thread or the documentation if they get stuck. Maybe mention what possible scenarios could cause the issue? (canvas or iframes rendering blurry). Nice. 👍Just to be clear, if a canvas does not listen for DPI changes, that is a bug in the canvas. This can happen in the real world for example if a window is dragged between two monitors or the zoom is changed (on desktop). So while setting the viewport before the page is loaded might “fix” the problem, it is actually just avoiding a bug in the website.