Screenshot of a particular area with Python and Puppeteer

Install Python Puppeteer Implementation and Chromium

pip install pyppeteer

Take a screenshot of the clip and save to file

import asyncio
from pyppeteer import launch

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

    await page.goto('')
    await page.screenshot({'path': 'clip.png', 'clip': {'x': 300, 'y': 300, 'width': 480, 'height': 240}})

    await browser.close()

Find out how to take a full-page screenshot with Python and Puppeteer.

We created Urlbox to make converting HTML to images easy

Learn more about our website screenshot API.