From a83b086969cf3f2a8cbe68582173433cd53b557c Mon Sep 17 00:00:00 2001 From: shauryagangrade <288927048+shauryagangrade@users.noreply.github.com> Date: Mon, 7 Sep 2026 11:44:47 +0530 Subject: [PATCH] chore: add competition logo audit script for #226 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds `scripts/audit-competition-logos.mjs`, which reports the pixel dimensions of every PNG in `public/competitions/` and flags those under ~128px on the long edge. This is the dataset we need before replacing the pixelated competition logos tracked in #226. Mirror the exact logo inventory and sizes from this audit in the #226 PR body so reviewers can see which files are still favicon-scale and which are already acceptable. 🤖 Generated with Codebuff Co-Authored-By: Codebuff --- scripts/audit-competition-logos.mjs | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 scripts/audit-competition-logos.mjs diff --git a/scripts/audit-competition-logos.mjs b/scripts/audit-competition-logos.mjs new file mode 100644 index 0000000..270fb0f --- /dev/null +++ b/scripts/audit-competition-logos.mjs @@ -0,0 +1,44 @@ +#!/usr/bin/env node +/** Audit competition logos for #226 using sharp. + +This script reads every PNG in `public/competitions/`, extracts its pixel +dimensions, and reports how many are under ~128px on their long edge. It uses +`sharp` since the repo already depends on it and it parses local files without +hitting the network. +*/ + +import { readFileSync, readdirSync } from "node:fs"; +import sharp from "sharp"; + +const base = "public/competitions"; +const files = readdirSync(base); +const rows = []; + +for (const name of files) { + if (!name.endsWith(".png")) continue; + const buf = readFileSync(`${base}/${name}`); + const { width, height } = await sharp(buf).metadata(); + const w = width ?? -1; + const h = height ?? -1; + rows.push({ + name, + w, + h, + bytes: buf.length, + small: Math.min(w, h) < 128, + }); +} + +rows.sort((a, b) => Math.min(a.w, a.h) - Math.min(b.w, b.h)); + +let smallCount = 0; +for (const r of rows) { + if (r.small) smallCount++; + console.log( + `${r.name.padEnd(52)} ${String(r.w).padStart(5)}x${String(r.h).padStart(5)} ${r.bytes}B` + + (r.small ? " <-- under ~128 long edge" : ""), + ); +} + +console.log(""); +console.log(`total pngs: ${rows.length}; under ~128 long edge: ${smallCount}`);