question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

blurry canvas if deviceScaleFactor > 1

See original GitHub issue

Steps 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?

  1. 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();
  1. 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:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bbughcommented, Apr 20, 2019

That looks great to me! We actually got caught on setContent, not goto, 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. 👍

0reactions
JoelEinbindercommented, Apr 22, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found