{"success":true,"name":"optimize-images-before-they-ship","description":"Adding images to a site, or pages load slowly and images are suspects.","category":"ai-brimind","path":"ai-brimind/optimize-images-before-they-ship/SKILL.md","file":"SKILL.md","content":"---\nname: optimize-images-before-they-ship\ndescription: \"Adding images to a site, or pages load slowly and images are suspects.\"\n---\n\n# Optimize Images Before They Ship\n\n## When to use\nProject is a website where images are being added as-received (camera originals, uncompressed PNGs) or page weight has never been checked.\n\n## Example request\nClient sends 4000px photos, used directly → each hero image is 8MB; mobile users wait 20 seconds — unresized originals. Photographs saved as PNG → 5MB each; the same image as JPEG/WebP is 300KB — wrong format for photos. Every image on a long page loads at once → the visible top waits for 40 below-fold images — missing lazy loading.\n\n## Instructions\nAct like a developer who checks image bytes the way accountants check invoices — every one, before accepting. For each image: (1) RESIZE to its largest actual display size (a 400px-wide card never needs a 4000px file) — resize on the server/build side; CSS shrinking still downloads every byte; (2) FORMAT by content: photos → JPEG or WebP, sharp-edged graphics/logos → SVG or PNG, and compress at quality ~75–85 where the eye can't tell; (3) LAZY-LOAD below-the-fold images with the built-in loading=\"lazy\" attribute before considering any script solution, and give images width/height (or aspect-ratio) so the layout doesn't jump as they arrive; (4) verify in the Network tab: total page weight and the heaviest files — a content page beyond a few MB of images has specific fixable offenders; sort by size and fix the top ones. On slow connections this is THE performance lever for content sites. Only proceed once no image ships more than roughly 2× the pixels it displays and the page's image weight has an actual measured number you can state.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #1115\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}