Curated website design inspiration gallery, open zero-auth MCP server for AI agents, and shareable moodboard lists.
JavaScript ai-agentschatgptclaude-codecodexcurated-listcursordesign-gallerydesign-inspirationdesign-systemsdesign-tastefrontendmcpmcp-servermodel-context-protocolmoodboardopen-sourceui-designweb-design
#!/usr/bin/env node
/**
* Deterministically renders DesignTaste's multi-column looping motion OG assets:
* 1. apps/gallery/og.jpg (1200×630 static hero OG for social unfurls)
* 2. docs/images/og-motion.mp4 (1200×630 60fps seamless 8s H.264 loop)
* 3. docs/images/og-motion.gif (720×378 16fps seamless 8s optimized GIF)
* 4. docs/images/social-preview.gif (640×320 12.5fps seamless 1.92s <1MB tilted 4-col GIF)
*
* Pass --social-only to regenerate only docs/images/social-preview.gif.
*
* Uses local Chrome/Chromium via playwright-core + bundled Geist fonts + real
* catalog thumbnails from apps/gallery/assets/ (zero network access).
*/
import fs from "node:fs";
import path from "node:path";
import { spawn } from "node:child_process";
import { fileURLToPath } from "node:url";
import { chromium } from "playwright-core";
import sharp from "sharp";
const ROOT = fileURLToPath(new URL("..", import.meta.url));
const GALLERY_DIR = path.join(ROOT, "apps/gallery");
const DOCS_IMG_DIR = path.join(ROOT, "docs/images");
const WIDTH = 1200;
const HEIGHT = 630;
const DURATION_S = 8;
const FPS = 60;
const TOTAL_FRAMES = DURATION_S * FPS; // 480 frames for 60fps seamless loop
const COLUMNS = [
["linear", "stripe-press", "raycast", "cosmos", "huly", "paper-design"],
["cursor", "stripe", "playdate", "analogue", "elevenlabs", "tana"],
["recraft", "anthropic", "rive", "figma", "sketch", "railway"],
["framer", "krea-3", "mercury", "mintlify", "daylight", "teenage-engineering"],
];
// Initial phase offsets (0..1) so neighboring columns never line up horizontally
// and t=0 frames an iconic, color-balanced composition for the static OG still.
const PHASES = [0.24, 0.27, 0.25, 0.44];
// Alternating vertical directions: +1 = scrolls UP, -1 = scrolls DOWN.
const DIRECTIONS = [1, -1, 1, -1];
function findChrome() {
const candidates = [
process.env.CHROME_PATH,
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
"/Applications/Chromium.app/Contents/MacOS/Chromium",
"/Applications/Brave Browser.app/Contents/MacOS/Brave Browser",
"/Applications/Arc.app/Contents/MacOS/Arc",
"/usr/bin/google-chrome",
"/usr/bin/chromium",
].filter(Boolean);
const found = candidates.find((p) => fs.existsSync(p));
if (!found) throw new Error("No local Chrome/Chromium binary found.");
return found;
}
async function loadCardDataUrls() {
const sites = JSON.parse(
fs.readFileSync(path.join(GALLERY_DIR, "sites.json"), "utf8"),
);
const byId = new Map(sites.map((s) => [s.id, s]));
const result = [];
for (const col of COLUMNS) {
const cards = [];
for (const id of col) {
const site = byId.get(id);
if (!site) throw new Error(`Missing showcase site id: ${id}`);
const imgPath = path.join(GALLERY_DIR, site.image);
const buf = await sharp(imgPath)
.resize(640, 400, { fit: "cover", position: "top" })
.jpeg({ quality: 88, mozjpeg: true })
.toBuffer();
cards.push({
id,
name: site.name,
dataUrl: `data:image/jpeg;base64,${buf.toString("base64")}`,
});
}
result.push(cards);
}
return { columns: result, totalSites: sites.length };
}
function buildSceneHtml({ columns, totalSites }) {
const geistSans = fs
.readFileSync(path.join(GALLERY_DIR, "fonts/geist-variable.woff2"))
.toString("base64");
const geistMono = fs
.readFileSync(path.join(GALLERY_DIR, "fonts/geist-mono-variable.woff2"))
.toString("base64");
const CARD_W = 324;
const CARD_H = 202;
const GAP = 16;
const STRIDE = CARD_H + GAP; // 218px per card
const SET_H = columns[0].length * STRIDE; // 6 * 218 = 1308px exact seamless repeat
const columnsMarkup = columns
.map((cards, colIdx) => {
// Repeat 3x so the rotated column always overflows top and bottom cleanly.
const tripled = [...cards, ...cards, ...cards];
const items = tripled
.map(
(c) =>
`<div class="card"><img src="${c.dataUrl}" alt=""></div>`,
)
.join("");
return `<div class="col"><div class="track" data-col="${colIdx}">${items}</div></div>`;
})
.join("");
return `<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
@font-face {
font-family: "Geist";
src: url("data:font/woff2;base64,${geistSans}") format("woff2");
font-weight: 100 900;
font-style: normal;
font-display: block;
}
@font-face {
font-family: "Geist Mono";
src: url("data:font/woff2;base64,${geistMono}") format("woff2");
font-weight: 100 900;
font-style: normal;
font-display: block;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
width: ${WIDTH}px;
height: ${HEIGHT}px;
overflow: hidden;
background: #070709;
font-family: "Geist", -apple-system, BlinkMacSystemFont, sans-serif;
-webkit-font-smoothing: antialiased;
}
.stage {
position: relative;
width: ${WIDTH}px;
height: ${HEIGHT}px;
overflow: hidden;
background:
radial-gradient(ellipse 58% 60% at 22% 0%, rgba(129, 140, 248, 0.24), transparent 70%),
radial-gradient(ellipse 52% 58% at 84% 100%, rgba(255, 77, 109, 0.16), transparent 70%),
#070709;
}
.wall {
position: absolute;
top: 50%;
left: 50%;
width: 1368px;
height: 1200px;
display: grid;
grid-template-columns: repeat(4, ${CARD_W}px);
gap: ${GAP}px;
transform: translate(-50%, -50%) rotate(-7deg);
transform-origin: center center;
opacity: 0.96;
}
.col {
position: relative;
height: 100%;
overflow: visible;
}
.track {
display: flex;
flex-direction: column;
gap: ${GAP}px;
will-change: transform;
}
.card {
width: ${CARD_W}px;
height: ${CARD_H}px;
border-radius: 14px;
overflow: hidden;
background: #141418;
border: 1px solid rgba(255, 255, 255, 0.15);
box-shadow:
0 18px 40px -14px rgba(0, 0, 0, 0.85),
inset 0 1px 0 rgba(255, 255, 255, 0.18);
flex-shrink: 0;
}
.card img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
object-position: top center;
}
/* Soft edge vignette + subtle studio depth */
.vignette {
position: absolute;
inset: 0;
pointer-events: none;
background:
linear-gradient(180deg, rgba(7, 7, 9, 0.72) 0%, rgba(7, 7, 9, 0.04) 20%, rgba(7, 7, 9, 0.04) 80%, rgba(7, 7, 9, 0.76) 100%),
linear-gradient(90deg, rgba(7, 7, 9, 0.42) 0%, rgba(7, 7, 9, 0) 12%, rgba(7, 7, 9, 0) 88%, rgba(7, 7, 9, 0.42) 100%),
radial-gradient(ellipse 46% 50% at 50% 50%, rgba(7, 7, 9, 0.66) 0%, rgba(7, 7, 9, 0.18) 62%, transparent 100%);
}
/* Centered floating obsidian glass lockup */
.hero-wrap {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
pointer-events: none;
}
.hero-card {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
gap: 14px;
padding: 28px 44px 30px;
border-radius: 26px;
background: rgba(11, 11, 15, 0.80);
backdrop-filter: blur(24px) saturate(1.45);
-webkit-backdrop-filter: blur(24px) saturate(1.45);
border: 1px solid rgba(255, 255, 255, 0.17);
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.22),
0 32px 90px -10px rgba(0, 0, 0, 0.92),
0 0 80px -20px rgba(129, 140, 248, 0.34);
}
.brand-row {
display: inline-flex;
align-items: center;
gap: 11px;
}
.brand-name {
font-size: 20px;
font-weight: 620;
letter-spacing: -0.025em;
color: #f6f6f9;
}
.brand-name .dot {
color: #8b8b9b;
font-weight: 450;
}
.mcp-pill {
font-family: "Geist Mono", monospace;
font-size: 11px;
font-weight: 550;
letter-spacing: 0.06em;
text-transform: uppercase;
padding: 4px 10px;
border-radius: 999px;
color: #d6deff;
background: rgba(129, 140, 248, 0.18);
border: 1px solid rgba(165, 180, 252, 0.38);
}
.headline {
font-size: 48px;
font-weight: 660;
letter-spacing: -0.04em;
line-height: 1.04;
background: linear-gradient(180deg, #ffffff 10%, #cfd3e6 100%);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.sub {
font-size: 15.5px;
font-weight: 450;
letter-spacing: -0.01em;
color: #b2b3c2;
display: flex;
align-items: center;
gap: 10px;
}
.sub .sep {
color: #5b5c6e;
}
</style>
</head>
<body>
<div class="stage">
<div class="wall">${columnsMarkup}</div>
<div class="vignette"></div>
<div class="hero-wrap">
<div class="hero-card">
<div class="brand-row">
<svg width="32" height="32" viewBox="0 0 40 40" fill="none" aria-hidden="true">
<defs>
<linearGradient id="og-g" x1="0" y1="0" x2="1" y2="1">
<stop offset="0%" stop-color="#22222b"/>
<stop offset="100%" stop-color="#0b0b0e"/>
</linearGradient>
<linearGradient id="og-s" x1="0" y1="0" x2="1" y2="1">
<stop offset="0%" stop-color="#ffffff"/>
<stop offset="100%" stop-color="#a5b4fc"/>
</linearGradient>
</defs>
<rect width="40" height="40" rx="11" fill="url(#og-g)" stroke="#ffffff" stroke-opacity="0.22" stroke-width="1.5"/>
<path d="M13 11.5h6.2c5.4 0 8.8 3.3 8.8 8.5s-3.4 8.5-8.8 8.5H13V11.5Zm4.2 3.5v10h1.9c3 0 4.6-1.8 4.6-5s-1.6-5-4.6-5h-1.9Z" fill="url(#og-s)"/>
<circle cx="29.5" cy="11.5" r="2.7" fill="#ff4d6d"/>
</svg>
<span class="brand-name">designtaste<span class="dot">.wtf</span></span>
<span class="mcp-pill">Open MCP</span>
</div>
<h1 class="headline">Curated web design taste.</h1>
<p class="sub">
<span>${totalSites} standout websites</span>
<span class="sep">·</span>
<span>Zero-auth MCP</span>
<span class="sep">·</span>
<span>Shareable moodboards</span>
</p>
</div>
</div>
</div>
<script>
const SET_H = ${SET_H};
const PHASES = ${JSON.stringify(PHASES)};
const DIRECTIONS = ${JSON.stringify(DIRECTIONS)};
const tracks = [...document.querySelectorAll(".track")];
window.setProgress = function (t) {
for (let i = 0; i < tracks.length; i++) {
const dir = DIRECTIONS[i];
const phase = PHASES[i];
// Seamless wrap modulo SET_H, anchored cleanly inside the middle repeat (-SET_H .. -2*SET_H)
const raw = dir > 0 ? (phase + t) % 1 : (phase + (1 - (t % 1))) % 1;
const y = -(SET_H * 0.5 + raw * SET_H);
tracks[i].style.transform = "translate3d(0," + y.toFixed(3) + "px,0)";
}
};
window.setProgress(0);
</script>
</body>
</html>`;
}
async function runCmd(cmd, args) {
return new Promise((resolve, reject) => {
const p = spawn(cmd, args, { stdio: ["ignore", "pipe", "pipe"] });
let err = "";
p.stderr.on("data", (d) => (err += d.toString()));
p.on("close", (code) => {
if (code === 0) resolve();
else reject(new Error(`${cmd} exited ${code}: ${err.slice(-400)}`));
});
});
}
async function renderSocialPreviewGif(browser, data) {
const W = 640;
const H = 320;
const SP_FRAMES = 24; // 1.92s @ 12.5fps (exact 80ms/frame GIF delay, seamless loop)
const SP_FPS = 12.5;
// 8 iconic sites across 4 tilted alternating columns (larger cards -> SET_H=304px, zero visible dupes!)
const SP_COLS = [
["linear", "raycast"],
["stripe", "playdate"],
["recraft", "rive"],
["mercury", "daylight"],
];
const SP_PHASES = [0.22, 0.36, 0.14, 0.48];
const SP_DIRS = [1, -1, 1, -1];
const byId = new Map(data.columns.flat().map((c) => [c.id, c]));
const geistSans = fs
.readFileSync(path.join(GALLERY_DIR, "fonts/geist-variable.woff2"))
.toString("base64");
const geistMono = fs
.readFileSync(path.join(GALLERY_DIR, "fonts/geist-mono-variable.woff2"))
.toString("base64");
const CARD_W = 208;
const CARD_H = 140;
const GAP = 12;
const STRIDE = CARD_H + GAP; // 152px
const SET_H = 2 * STRIDE; // 304px (> visible height with vignette -> no duplicate cards visible)
const colsHtml = SP_COLS.map((ids, ci) => {
const cards = ids.map((id) => byId.get(id));
const rep = [...cards, ...cards, ...cards, ...cards, ...cards];
return `<div class="col"><div class="track" data-col="${ci}">${rep
.map((c) => `<div class="card"><img src="${c.dataUrl}" alt=""></div>`)
.join("")}</div></div>`;
}).join("");
const html = `<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
@font-face{font-family:"Geist";src:url("data:font/woff2;base64,${geistSans}") format("woff2");font-weight:100 900;font-display:block}
@font-face{font-family:"Geist Mono";src:url("data:font/woff2;base64,${geistMono}") format("woff2");font-weight:100 900;font-display:block}
*{box-sizing:border-box;margin:0;padding:0}
html,body{width:${W}px;height:${H}px;overflow:hidden;background:#070709;font-family:"Geist",-apple-system,sans-serif;-webkit-font-smoothing:antialiased}
.stage{position:relative;width:${W}px;height:${H}px;overflow:hidden;background:#070709}
.wall{
position:absolute;
top:50%;
left:50%;
width:${4 * CARD_W + 3 * GAP}px;
height:760px;
display:grid;
grid-template-columns:repeat(4,${CARD_W}px);
gap:${GAP}px;
transform:translate(-50%,-50%) rotate(-7deg);
opacity:0.95;
}
.col{position:relative;height:100%;overflow:visible}
.track{display:flex;flex-direction:column;gap:${GAP}px;will-change:transform}
.card{
width:${CARD_W}px;
height:${CARD_H}px;
border-radius:10px;
overflow:hidden;
background:#141418;
border:1px solid rgba(255,255,255,0.18);
flex-shrink:0;
}
.card img{display:block;width:100%;height:100%;object-fit:cover;object-position:top center}
.vignette{
position:absolute;
inset:0;
pointer-events:none;
background:
linear-gradient(180deg,#070709 0%,rgba(7,7,9,0.06) 24%,rgba(7,7,9,0.06) 76%,#070709 100%),
linear-gradient(90deg,rgba(7,7,9,0.52) 0%,rgba(7,7,9,0) 14%,rgba(7,7,9,0) 86%,rgba(7,7,9,0.52) 100%);
}
.hero-wrap{position:absolute;inset:0;display:flex;align-items:center;justify-content:center}
/* Solid obsidian center card stays pixel-identical across frames so GIF frame-diff preserves 128 rich colors at near-lossless quality under 1MB */
.hero-card{
display:flex;
flex-direction:column;
align-items:center;
text-align:center;
gap:8px;
padding:17px 28px 18px;
border-radius:15px;
background:#0b0b0f;
border:1px solid rgba(255,255,255,0.22);
box-shadow:0 18px 46px -4px rgba(0,0,0,0.96);
}
.brand-row{display:inline-flex;align-items:center;gap:6px}
.brand-name{font-size:12px;font-weight:620;letter-spacing:-0.02em;color:#f6f6f9}
.brand-name .dot{color:#8b8b9b;font-weight:450}
.mcp-pill{
font-family:"Geist Mono",monospace;
font-size:7px;
font-weight:600;
letter-spacing:0.06em;
text-transform:uppercase;
padding:2.5px 7px;
border-radius:999px;
color:#d6deff;
background:#1b1e36;
border:1px solid rgba(165,180,252,0.44);
}
.headline{font-size:27px;font-weight:680;letter-spacing:-0.04em;line-height:1.04;color:#f7f8fc}
.sub{font-size:9.5px;font-weight:460;letter-spacing:-0.01em;color:#b8b9c8;display:flex;align-items:center;gap:5px}
.sub .sep{color:#5b5c6e}
</style>
</head>
<body>
<div class="stage">
<div class="wall">${colsHtml}</div>
<div class="vignette"></div>
<div class="hero-wrap">
<div class="hero-card">
<div class="brand-row">
<svg width="19" height="19" viewBox="0 0 40 40" fill="none" aria-hidden="true">
<rect width="40" height="40" rx="11" fill="#17171f" stroke="#ffffff" stroke-opacity="0.25" stroke-width="1.8"/>
<path d="M13 11.5h6.2c5.4 0 8.8 3.3 8.8 8.5s-3.4 8.5-8.8 8.5H13V11.5Zm4.2 3.5v10h1.9c3 0 4.6-1.8 4.6-5s-1.6-5-4.6-5h-1.9Z" fill="#e6eaff"/>
<circle cx="29.5" cy="11.5" r="2.8" fill="#ff4d6d"/>
</svg>
<span class="brand-name">designtaste<span class="dot">.wtf</span></span>
<span class="mcp-pill">Open MCP</span>
</div>
<h1 class="headline">Curated web design taste.</h1>
<p class="sub">
<span>${data.totalSites} standout websites</span>
<span class="sep">·</span>
<span>Zero-auth MCP</span>
<span class="sep">·</span>
<span>Shareable moodboards</span>
</p>
</div>
</div>
</div>
<script>
const SET_H = ${SET_H};
const PHASES = ${JSON.stringify(SP_PHASES)};
const DIRS = ${JSON.stringify(SP_DIRS)};
const tracks = [...document.querySelectorAll(".track")];
window.setProgress = function (t) {
for (let i = 0; i < tracks.length; i++) {
const r = DIRS[i] > 0 ? (PHASES[i] + t) % 1 : (PHASES[i] + (1 - (t % 1))) % 1;
const y = -(SET_H * 1.5 + r * SET_H);
tracks[i].style.transform = "translate3d(0," + y.toFixed(2) + "px,0)";
}
};
window.setProgress(0);
</script>
</body>
</html>`;
const page = await browser.newPage({
viewport: { width: W, height: H },
deviceScaleFactor: 1,
});
await page.setContent(html, { waitUntil: "load" });
await page.evaluate(() => document.fonts.ready);
// Direct lossless RGB PNG frames -> zero H.264/YUV420 noise on dark areas
const tmpDir = "/tmp/designtaste-sp-frames";
fs.rmSync(tmpDir, { recursive: true, force: true });
fs.mkdirSync(tmpDir, { recursive: true });
for (let frame = 0; frame < SP_FRAMES; frame++) {
await page.evaluate((p) => window.setProgress(p), frame / SP_FRAMES);
const framePath = path.join(tmpDir, `f_${String(frame).padStart(3, "0")}.png`);
await page.screenshot({ path: framePath, type: "png" });
}
await page.close();
const tmpPal = path.join(tmpDir, "pal.png");
const tmpGif = path.join(tmpDir, "raw.gif");
const outGif = path.join(DOCS_IMG_DIR, "social-preview.gif");
// Pick highest visual quality preset (128-144 rich colors + near-lossless) strictly < 990KB decimal
const presets = [
{ colors: 144, lossy: 15 },
{ colors: 128, lossy: 15 },
{ colors: 128, lossy: 20 },
{ colors: 112, lossy: 20 },
];
let chosen = null;
for (const preset of presets) {
await runCmd("ffmpeg", [
"-y",
"-framerate",
String(SP_FPS),
"-i",
path.join(tmpDir, "f_%03d.png"),
"-vf",
`palettegen=max_colors=${preset.colors}:stats_mode=diff`,
tmpPal,
]);
await runCmd("ffmpeg", [
"-y",
"-framerate",
String(SP_FPS),
"-i",
path.join(tmpDir, "f_%03d.png"),
"-i",
tmpPal,
"-lavfi",
"paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle",
"-loop",
"0",
tmpGif,
]);
await runCmd("gifsicle", [
"-O3",
`--lossy=${preset.lossy}`,
tmpGif,
"-o",
outGif,
]);
const bytes = fs.statSync(outGif).size;
if (bytes < 990_000) {
chosen = { ...preset, bytes };
break;
}
}
fs.rmSync(tmpDir, { recursive: true, force: true });
if (!chosen) {
throw new Error("Could not fit social-preview.gif under 990KB.");
}
console.log(
`Wrote <1MB GitHub social preview GIF: ${outGif} (${(chosen.bytes / 1024).toFixed(1)} KB / ${chosen.bytes} bytes, ${chosen.colors} colors, lossy=${chosen.lossy})`,
);
}
async function main() {
const socialOnly = process.argv.includes("--social-only");
fs.mkdirSync(DOCS_IMG_DIR, { recursive: true });
const data = await loadCardDataUrls();
const browser = await chromium.launch({
executablePath: findChrome(),
headless: true,
args: ["--disable-gpu-sandbox", "--font-render-hinting=none"],
});
if (socialOnly) {
await renderSocialPreviewGif(browser, data);
await browser.close();
return;
}
const html = buildSceneHtml(data);
const page = await browser.newPage({
viewport: { width: WIDTH, height: HEIGHT },
deviceScaleFactor: 1,
});
await page.setContent(html, { waitUntil: "load" });
await page.evaluate(() => document.fonts.ready);
// 1. Capture ultra-crisp static OG hero still (apps/gallery/og.jpg)
await page.evaluate(() => window.setProgress(0));
const staticPng = await page.screenshot({ type: "png" });
const ogJpgPath = path.join(GALLERY_DIR, "og.jpg");
await sharp(staticPng).jpeg({ quality: 91, mozjpeg: true }).toFile(ogJpgPath);
console.log(
`Wrote static OG: ${ogJpgPath} (${(fs.statSync(ogJpgPath).size / 1024).toFixed(1)} KB)`,
);
// 2. Stream 480 deterministic 60fps frames directly to ffmpeg -> MP4
const mp4Path = path.join(DOCS_IMG_DIR, "og-motion.mp4");
const ffmpeg = spawn(
"ffmpeg",
[
"-y",
"-f",
"image2pipe",
"-vcodec",
"mjpeg",
"-r",
String(FPS),
"-i",
"-",
"-c:v",
"libx264",
"-profile:v",
"high",
"-level",
"4.1",
"-pix_fmt",
"yuv420p",
"-crf",
"18",
"-preset",
"slow",
"-movflags",
"+faststart",
mp4Path,
],
{ stdio: ["pipe", "ignore", "pipe"] },
);
let ffErr = "";
ffmpeg.stderr.on("data", (d) => (ffErr += d.toString()));
const ffDone = new Promise((resolve, reject) => {
ffmpeg.on("close", (code) => {
if (code === 0) resolve();
else reject(new Error(`ffmpeg exited ${code}: ${ffErr.slice(-500)}`));
});
});
for (let frame = 0; frame < TOTAL_FRAMES; frame++) {
const t = frame / TOTAL_FRAMES;
await page.evaluate((p) => window.setProgress(p), t);
const jpg = await page.screenshot({ type: "jpeg", quality: 96 });
if (!ffmpeg.stdin.write(jpg)) {
await new Promise((r) => ffmpeg.stdin.once("drain", r));
}
}
ffmpeg.stdin.end();
await ffDone;
await page.close();
console.log(
`Wrote 60fps seamless MP4: ${mp4Path} (${(fs.statSync(mp4Path).size / 1024 / 1024).toFixed(2)} MB)`,
);
// 3. Create crisp seamless looping GIF from the 60fps MP4 (16fps, 720x378, gifsicle-optimized <10MB)
const rawGif = "/tmp/designtaste-og-raw.gif";
const gifPath = path.join(DOCS_IMG_DIR, "og-motion.gif");
await runCmd("ffmpeg", [
"-y",
"-i",
mp4Path,
"-vf",
"fps=16,scale=720:378:flags=lanczos,format=rgb24,split[s0][s1];[s0]palettegen=max_colors=96:stats_mode=diff[p];[s1][p]paletteuse=dither=bayer:bayer_scale=4:diff_mode=rectangle",
"-loop",
"0",
rawGif,
]);
await runCmd("gifsicle", ["-O3", "--lossy=85", rawGif, "-o", gifPath]);
fs.rmSync(rawGif, { force: true });
console.log(
`Wrote seamless GIF: ${gifPath} (${(fs.statSync(gifPath).size / 1024 / 1024).toFixed(2)} MB)`,
);
// 4. Create <1MB 640x320 GitHub Social Preview GIF
await renderSocialPreviewGif(browser, data);
await browser.close();
}
main().catch((err) => {
console.error(err);
process.exit(1);
});