Capturing project covers with headless Chrome
A portfolio needs pictures of the work. The browser already on your machine will take them.
27 Aug 2026
The question
This site had a project write-up for a restaurant website with no picture of the restaurant website. Several thousand pixels of prose about a visual product, and nothing to look at.
Manual screenshots are the obvious answer, and the wrong one: inconsistent sizes, whatever the window happened to be, a scrollbar down the side, and impossible to redo identically when the design changes.
Setup
Chrome takes screenshots from the command line. No dependency, no service, no account:
chrome --headless=new \
--disable-gpu \
--hide-scrollbars \
--virtual-time-budget=9000 \
--window-size=1600,1000 \
--screenshot="hero.png" \
"https://example.com"
--hide-scrollbars removes the gutter that ruins an otherwise clean capture, and
--virtual-time-budget waits for fonts, images and entry animations to settle instead of
firing at first paint.
The raw PNG comes out around 1.7MB, which is far too heavy to commit. sharp — already
present in any Next.js project — converts it:
await sharp(input)
.resize({ width: 1600, withoutEnlargement: true })
.jpeg({ quality: 80, mozjpeg: true })
.toFile(output);
Result
1.7MB → 151KB, at full display resolution. Four captures — home, menu, gallery and a 420px mobile view — took under a minute and are byte-identical if re-run.
Learned
The whole thing is a script, which is the actual point. When a project gets redesigned, the covers regenerate rather than being re-taken by hand at a slightly different size.
Same technique works for Open Graph images, visual regression baselines, and mocking up a client's existing site before a pitch.
How I actually build with Claude Code
The working loop — project context, questions before code, and small slices verified in the browser.
Read ProjectsThe prompt system I use to build client websites
Two documents instead of one prompt — a permanent quality standard, and a per-client brief.
Read ProjectsShot Planning Toolkit
A pacing guide, a storyboard and a briefing — enough to run a shoot with a first-timer.
ReadNeed something built along these lines?