Skip to content

Instantly share code, notes, and snippets.

View matsuyama-k1's full-sized avatar

matsuyama-k1

  • Tokyo
View GitHub Profile
@matsuyama-k1
matsuyama-k1 / puppeteer-larger-than-16384px.ts
Last active October 14, 2024 04:16
one solution for taking screen shot larger than 16384px with puppeteer. https://github.com/puppeteer/puppeteer/issues/359
import { Page } from "puppeteer";
import sharp from "sharp";
// Max texture size of the software GL backand of chronium. (16384px or 4096px)
// https://issues.chromium.org/issues/41347676
export const MAX_SIZE_PX = 16384;
const takeFullPageScreenshot = async (page: Page) => {
const pageHeight = await getPageHeight(page);
const deviceScaleFactor = page.viewport()?.deviceScaleFactor ?? 1;