Capturing project covers with headless Chrome
A portfolio needs pictures of the work. If the work is a live site, the browser already installed on your machine will take them — no service, no subscription.
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 — persistent project context, questions before code, small verified slices, and checking the browser instead of trusting the summary.
Read ResourcesThe prompt system I use to build client websites
Two documents instead of one prompt — a permanent quality standard, and a per-client brief. Why the split is the part that actually works.
Read ProjectsThis site
A personal platform built to grow — five content collections, a design system in one file, and a publishing loop that starts on Instagram and ends here.
ReadGot something you want tested properly?