// URL -> transparent PNG (omitBackground) at 2x
const [url, w, h, out] = process.argv.slice(2);
const { chromium } = await import('playwright');
const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: +w, height: +h }, deviceScaleFactor: 2 });
await page.goto(url, { waitUntil: 'networkidle' });
try { await page.evaluate(() => document.fonts && document.fonts.ready); } catch {}
await page.waitForTimeout(500);
await page.screenshot({ path: out, omitBackground: true });
await browser.close();
console.log('SAVED ' + out + ' (alpha)');
