Screenshot of a particular quality with Python and Puppeteer

Install Python Puppeteer Implementation and Chromium

pip install pyppeteer

Take a screenshot with quality level set and save to file

import asyncio
from pyppeteer import launch

async def main():
    browser = await launch()
    page = await browser.newPage()

    await page.setContent("<h1>Hello World</h1>")
    await page.screenshot({'path': "html.jpg", 'type': 'jpeg', 'quality': 50))

    await browser.close()

Find out how to take a retina screenshot with Python and Puppeteer.

We created Urlbox to make converting HTML to images easy

Learn more about our website screenshot API.