real-images — download all images from a website and use them locally
A skill for Claude Code, Codex and Cursor that downloads a website's real images, SVGs, videos and fonts to your project and rewrites the URLs to local paths — without changing a single line of your code.
When you ask an AI coding agent to clone a website, it recreates the layout
and then leaves the pictures remote: the original CDN URL, or a stock photo from
images.unsplash.com. Go offline, or hit a hotlink block, and the page is empty.
So you end up saving images from the website by hand and wiring them in one by
one.
This skill does that part — automatically, after generation.
# the clone points at the original CDN → pull every asset local
python scripts/localize.py ./my-clone
# the clone used unsplash/picsum placeholders → fetch the real ones and drop them in
python scripts/grab.py https://the-real-site.com --project ./my-clone
Before:
<img src="https://images.unsplash.com/photo-1521..." alt="hero banner">
<div style="background-image:url(/img/6adf7f6fbb9c9db5?u=https%3A%2F%2Fcdn.site.com%2Fbg.jpg)">
After:
<img src="https://raw.githubusercontent.com/tgaurav1k/real-images/main/assets/images/hero-banner.webp" alt="hero banner">
<div style="background-image:url(/assets/images/bg.jpg)">
Same markup, same classes, same spacing, same animations. Only the URL strings changed.
Install
As a skill (Claude Code):
git clone https://github.com/Tgaurav1k/real-images.git ~/.claude/skills/real-images
Then just ask: "localize the assets in this project" / "use the real images from https://example.com". For Codex/Cursor, point the agent at SKILL.md, or run the scripts yourself.
Optional, only for grab.py:
pip install playwright && playwright install chromium
localize.py is pure Python stdlib.
What it finds
src, srcset, sizes variants, data-src / data-lazy-src / data-original,
<picture><source>, <video src> and poster, CSS background-image,
mask-image, border-image, list-style-image, cursor, content,
::before / ::after backgrounds, <use href> sprites, <object> / <embed>,
favicons, apple-touch-icon, og:image, twitter:image, @font-face sources,
.mp4/.webm, .woff2/.ttf/.otf, .glb/.gltf, and lottie .json with
--lottie.
How assets land
public/assets/
images/ hero.webp product-1.webp bg.jpg
icons/ menu.svg close.svg favicon.ico
fonts/ inter-var.woff2
videos/ loop.mp4
models/ scene.glb
assets-manifest.json # url → local file, bytes, sha256, referencing files
real-images.json # (grab.py) order, selector, alt, box, aspect per image
Identical files are stored once (sha256 dedupe), so hero.webp, hero(1).webp,
hero(2).webp never happen. No public/ or static/ directory? Assets go to
<project>/assets and references become relative.
Placeholder → real matching
grab.py walks the rendered DOM in document order and scores each placeholder
against each captured image on:
- page order — the nth image slot in the code ≈ the nth image on the page
- aspect ratio —
placehold.co/1600x900gets the 16:9 shot, not the square one - alt / nearby text overlap —
alt="team portrait"prefers the image whose alt or surrounding copy says the same
Run with --dry-run first; it prints the full mapping table. Wrong guess? Use
--capture-only and wire the images from real-images.json yourself — it records
each image's DOM position, selector, alt text and rendered box.
Flags
| flag | script | effect |
|---|---|---|
--dry-run |
both | no code edits (grab still downloads; localize downloads nothing) |
--out DIR |
both | asset directory |
--variants |
grab | download every srcset size, not just the chosen one |
--reuse |
grab | one real image may fill several placeholders |
--capture-only |
grab | download + manifest, no code edits |
--lottie |
localize | also localize remote .json animations |
--all-urls |
localize | also try extension-less URLs from unknown hosts |
--keep hosts |
localize | leave these hosts remote (default fonts.googleapis.com) |
--workers N |
localize | parallel downloads (default 8) |
Limits
- Assets behind auth, signed URLs, DRM or anti-bot protection won't download —
they're listed as
SKIPPEDwith the reason, never silently dropped. - Canvas/WebGL-rendered imagery isn't a file, so it can't be grabbed.
- Google Fonts
<link>stays remote by default: replacing it means rewriting@importinto@font-face, and that's a code change this skill won't make unasked. - Copyright. Website images are usually protected. Use this on sites you own or are authorized to rebuild, or for local prototyping — and swap in assets you have rights to before shipping.
FAQ
How do I download all the images from a website?
python scripts/grab.py https://example.com --capture-only. It renders the page
in Chromium, scrolls it so lazy images load, and saves every image the browser
actually used into assets/images (plus icons, fonts, videos), with a
real-images.json manifest describing where each one sat on the page.
How do I replace the Unsplash placeholder images in AI-generated code?
python scripts/grab.py https://the-real-site.com --project ./my-clone. Every
unsplash / picsum / placehold.co / /placeholder.svg reference is matched
to a real image by page order, aspect ratio and alt-text overlap, then the URL —
and only the URL — is rewritten.
Does it change my code?
No. It edits the URL substring inside src, srcset, poster, url(...) and
nothing else. Component structure, HTML hierarchy, CSS layout, JS logic, state,
animations and responsive breakpoints are untouched. The test suite asserts that
everything except the URL stays byte-identical.
Does it work with React, Next.js, Vue, Svelte, Astro and plain HTML?
Yes. It scans .html .css .scss .less .js .jsx .ts .tsx .vue .svelte .astro .json .md .mdx .php .twig .hbs .ejs .liquid .svg. Assets go to
public/assets (or static/assets) with /assets/... references, or to
<project>/assets with relative references for plain static sites.
Why are my images still missing after running it?
Check the printed report. Assets behind authentication, signed URLs, DRM or
anti-bot protection are listed as SKIPPED with the HTTP reason — they are never
silently dropped. Canvas/WebGL imagery isn't a file and can't be downloaded.
Is it legal to download a website's images?
The tooling is legal; redistributing the images may not be. Website images are usually copyrighted. Use this on sites you own or are authorized to rebuild, or for local prototyping, and swap in assets you have rights to before shipping.
Tests
python scripts/test_skill.py
Stdlib only, no browser, no network: it spins up a local HTTP server and checks URL scanning, naming, dedupe, path rewriting and placeholder matching — including that everything except the URL stays byte-identical.
MIT licensed. PRs welcome.
Built for the "clone this website" workflow in Claude Code, OpenAI Codex, Cursor, Windsurf and Copilot Agent.
Keywords: download all images from website, website asset downloader, save website images locally, localize assets, replace unsplash placeholder images, claude code skill, claude skill, codex skill, cursor skill, website clone assets, offline website clone, download srcset images, download css background images, download web fonts, playwright image scraper, python image downloader.