import puppeteer from 'puppeteer';
import path from 'path';
const htmlPath = process.argv[2];
const outPath = process.argv[3];
if (!htmlPath || !outPath) {
console.error("Usage: node screenshot.js <input.html> <output.png>");
process.exit(1);
}
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({ width: 800, height: 600, deviceScaleFactor: 2 });
const fileUrl = 'file://' + path.resolve(htmlPath);
await page.goto(fileUrl, { waitUntil: 'networkidle0' });
await new Promise(resolve => setTimeout(resolve, 500));
await page.screenshot({ path: outPath });
await browser.close();
})();