import sharp from 'sharp';
import fs from 'fs';
async function generate() {
const popupSrc = 'public/screenshot1.png';
const meta = await sharp(popupSrc).metadata();
const canvasW = 1280;
const canvasH = 800;
// Scale popup card to 690px height
const targetH = 690;
const targetW = Math.round((meta.width / meta.height) * targetH);
const rx = 14;
const maskSvg = Buffer.from(`
`);
const roundedPopup = await sharp(popupSrc)
.resize(targetW, targetH, { fit: 'fill' })
.composite([{ input: maskSvg, blend: 'dest-in' }])
.png()
.toBuffer();
const x = Math.round((canvasW - targetW) / 2);
const y = Math.round((canvasH - targetH) / 2);
// Rounded icon badge for top-left
const iconRx = 8;
const iconMask = Buffer.from(`
`);
const logoBuf = await sharp('public/icons/icon-48.png')
.resize(40, 40)
.composite([{ input: iconMask, blend: 'dest-in' }])
.png()
.toBuffer();
const bgSvg = Buffer.from(`
`);
const borderSvg = Buffer.from(`
`);
const final1280 = await sharp(bgSvg)
.composite([
{ input: logoBuf, top: 40, left: 56 },
{ input: roundedPopup, top: y, left: x },
{ input: borderSvg, top: y, left: x }
])
.png()
.toBuffer();
await sharp(final1280).toFile('public/store-screenshot-1280x800.png');
console.log('✓ Generated public/store-screenshot-1280x800.png (1280x800)');
await sharp(final1280)
.resize(640, 400)
.png()
.toFile('public/store-screenshot-640x400.png');
console.log('✓ Generated public/store-screenshot-640x400.png (640x400)');
}
generate();