Puppeteer: How do I take a high resolution screenshot?

Created on 9 Nov 2017  ·  3Comments  ·  Source: puppeteer/puppeteer

Headless chrome would give me a normal resolution png file.
How can I set resolution?

one question: When I launch a browser, it means it deosn't open a real visual (non-headless) chromium, Am I right?

Most helpful comment

@MehdiRaash a screenshot corresponds to the pixels in the viewport.

Therefore to increase the resolution of a screenshot you need to increase the resolution of the viewport prior taking the screenshot. I.e.: To mimic a hDPI / retina screen, increase the deviceScaleFactor argument of setviewport.

For an example see: https://github.com/GoogleChrome/puppeteer/issues/571

All 3 comments

@MehdiRaash a screenshot corresponds to the pixels in the viewport.

Therefore to increase the resolution of a screenshot you need to increase the resolution of the viewport prior taking the screenshot. I.e.: To mimic a hDPI / retina screen, increase the deviceScaleFactor argument of setviewport.

For an example see: https://github.com/GoogleChrome/puppeteer/issues/571

@gebrits is spot on :)

Thanks @gebrits

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pyper picture pyper  ·  3Comments

vsemozhetbyt picture vsemozhetbyt  ·  3Comments

selfrefactor picture selfrefactor  ·  3Comments

namma-geniee picture namma-geniee  ·  3Comments

sradu picture sradu  ·  3Comments