lvl0-website/logo/screenshot.mjs

22 lines
675 B
JavaScript
Raw Permalink Normal View History

2026-09-01 20:30:09 +02:00
import { chromium } from 'playwright';
import { fileURLToPath } from 'url';
import path from 'path';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const htmlPath = path.join(__dirname, 'index.html');
const browser = await chromium.launch({
executablePath: '/etc/profiles/per-user/myrmidex/bin/chromium',
args: ['--no-sandbox'],
});
const page = await browser.newPage();
await page.setViewportSize({ width: 1200, height: 400 });
await page.goto(`file://${htmlPath}`);
await page.waitForTimeout(1000); // let font load
await page.screenshot({ path: path.join(__dirname, 'logo-full.png') });
console.log('Saved logo-full.png');
await browser.close();