Open source scripts to download external images, compress them to WebP, and replace URLs across your codebase.
The image pipeline is a set of open source Node.js scripts that solve a common problem in vibe-coded apps: images served from external URLs (builder CDNs, Unsplash, etc.) that you don’t control.This pipeline downloads those images, compresses them to WebP using Sharp, and replaces all URL references in your source code with local paths — dramatically improving page load times and eliminating dependency on third-party image hosts.
These scripts are open source and reusable in any Node.js project — not just Nometria deployments.
What it does
Three steps, run in sequence:
External image URLs in your code │ │ download-images.js ▼ public/images/*.png, *.jpg │ │ compress-images.js ▼ public/images/*.webp (originals deleted) │ │ replace-image-urls.js ▼ Source code updated to use /images/*.webp
export default { // Where to save downloaded images imagesDir: 'public/images', // External image URLs to download // Supports Unsplash, any direct image URL sources: [ 'https://images.unsplash.com/photo-1518770660439-4636190af475?w=1200', 'https://images.unsplash.com/photo-1555099962-4199c345e5dd?w=1200', // ... add all external image URLs your app uses ], // Directories to search when replacing URLs replaceInDirs: ['src', 'public'], // Compression options compress: { quality: 82, // WebP quality (0-100). 82 is a good balance. removeOriginals: true // Delete PNG/JPG after converting to WebP }};
Usage
# Run all three steps at once (recommended)pnpm run images# Or run steps individuallypnpm run images:download # Step 1: download externals to public/images/pnpm run images:compress # Step 2: convert to WebP, delete originalspnpm run images:replace-urls # Step 3: update URLs in source code
Example output
$ pnpm run imagesDownloading images... https://images.unsplash.com/photo-1518770... → public/images/photo-1518770660439.jpg ✓ (284 KB) https://images.unsplash.com/photo-1555099... → public/images/photo-1555099962.jpg ✓ (198 KB) Downloaded 2 images.Compressing images... photo-1518770660439.jpg → photo-1518770660439.webp... OK (41.2 KB) photo-1555099962.jpg → photo-1555099962.webp... OK (28.7 KB) Done. WebP files in public/images/Replacing URLs in source... src/pages/Home.jsx: 3 replacements src/components/Hero.jsx: 1 replacement Done. 4 replacements across 2 files.
After (fast — local WebP, served from your own host):
<img src="/images/photo-1518770660439.webp" />
Why WebP?
WebP provides 25–35% smaller file sizes compared to JPEG at equivalent visual quality, and 25–50% smaller than PNG for images with transparency. All modern browsers support WebP.The default quality setting of 82 is a good balance — noticeably smaller than JPEG at 90, with no visible quality difference at screen resolution.
Custom config path
If you want to keep the config outside scripts/:
IMAGE_ASSETS_CONFIG=./my-config.js pnpm run images
Integrating into your deploy workflow
Add image optimization as a pre-build step so it runs before every deployment:
Or run it manually when you add new images to your project, rather than on every build (since images don’t change often).
Source files
The package is available on npm and the source is on GitHub. The same scripts are embedded as templates in Nometria-generated projects.
{"docsConfig":{"theme":"palm","$schema":"https://mintlify.com/docs.json","name":"Nometria","colors":{"primary":"#dac99d","light":"#dfd7bf","dark":"#ef911e"},"logo":"https://mintcdn.com/nometria/427PYV9416J_hPzI/images/icon128.png?fit=max\u0026auto=format\u0026n=427PYV9416J_hPzI\u0026q=85\u0026s=db2ab2fb3995383d0debd8114b4906fe","favicon":"https://mintcdn.com/nometria/427PYV9416J_hPzI/images/icon128.png?fit=max\u0026auto=format\u0026n=427PYV9416J_hPzI\u0026q=85\u0026s=db2ab2fb3995383d0debd8114b4906fe","appearance":{"default":"system"},"navbar":{"links":[{"href":"mailto:hello@nometria.com","label":"Support"}],"primary":{"type":"button","label":"Dashboard","href":"https://nometria.com/dashboard"}},"footer":{"socials":{"x":"https://x.com/Nometria","github":"https://github.com/ownmy-app","linkedin":"https://linkedin.com/company/Nometria"}},"seo":{"indexing":"all"},"integrations":{"mixpanel":{"projectToken":"693fbc8642653ab062ab2c891389ea67"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Documentation","icon":"book-open-cover","href":"https://docs.nometria.com"},{"anchor":"Blog","icon":"newspaper","href":"https://nometria.com/blog"},{"anchor":"Free Tools","icon":"wrench","href":"https://nometria.com/tools"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"nometria","hasAudioNarration":false,"actualSubdomain":"nometria","customDomains":["docs.nometria.com"],"gitSource":{"type":"github","owner":"nometria","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6ae94a6c9198b3764e84d3dc:success","clientVersion":"0.0.4177","searchFilterCounts":[{"language":"default","tag":"Open Source Tools","count":19},{"language":"default","tag":"Getting Started","count":12},{"language":"default","tag":"CLI \u0026 AI Tools","count":9},{"language":"default","tag":"Python Packages","count":9},{"language":"default","tag":"AI Integrations","count":5},{"language":"default","tag":"Overview","count":5},{"language":"default","tag":"Migration Guides","count":5},{"language":"default","tag":"Platform Migrations","count":5},{"language":"default","tag":"nom CLI","count":4},{"language":"default","tag":"Connect Your App","count":4}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"tools/image-pipeline","slug":"/tools/image-pipeline","pageMetadata":{"title":"Image Compression Pipeline","description":"Open source scripts to download external images, compress them to WebP, and replace URLs across your codebase.","keywords":"image optimization, webp compression, image pipeline, download images, vite image optimization, nextjs images, sharp webp, image url rewrite, open source image tool, frontend performance","href":"/tools/image-pipeline"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Open source scripts to download external images, compress them to WebP, and replace URLs across your codebase.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Info}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`The image pipeline is a set of open source Node.js scripts that solve a common problem in vibe-coded apps: images served from external URLs (builder CDNs, Unsplash, etc.) that you don’t control.`}),`\n`,_jsxs(_components.p,{children:[`This pipeline downloads those images, compresses them to WebP using `,_jsx(_components.a,{href:`https://sharp.pixelplumbing.com/`,children:`Sharp`}),`, and replaces all URL references in your source code with local paths — dramatically improving page load times and eliminating dependency on third-party image hosts.`]}),`\n`,_jsx(Info,{children:_jsx(_components.p,{children:`These scripts are open source and reusable in any Node.js project — not just Nometria deployments.`})}),`\n`,_jsx(Heading,{level:`2`,id:`what-it-does`,children:`What it does`}),`\n`,_jsx(_components.p,{children:`Three steps, run in sequence:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`14`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`14`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`External image URLs in your code`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` │`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` │ download-images.js`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` ▼`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` public/images/*.png, *.jpg`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` │`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` │ compress-images.js`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` ▼`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` public/images/*.webp (originals deleted)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` │`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` │ replace-image-urls.js`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` ▼`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` Source code updated to use /images/*.webp`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Heading,{level:`2`,id:`installation`,children:`Installation`}),`\n`,_jsx(_components.p,{children:`Install from npm:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`npm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` install --save-dev @nometria-ai/img-opt sharp`})]}),`\n`]})})}),`\n`,_jsx(Info,{children:_jsxs(_components.p,{children:[`Available on npm as `,_jsx(_components.a,{href:`https://www.npmjs.com/package/@nometria-ai/img-opt`,children:`@nometria-ai/img-opt`}),` · Source on `,_jsx(_components.a,{href:`https://github.com/nometria/img-opt`,children:`GitHub`})]})}),`\n`,_jsxs(_components.p,{children:[`Or copy files into your project’s `,_jsx(_components.code,{children:`scripts/`}),` folder manually:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`scripts/download-images.js`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`scripts/compress-images.js`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`scripts/replace-image-urls.js`})}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`scripts/images-download-compress-replace.js`}),` (orchestrator)`]}),`\n`,_jsx(_components.li,{children:_jsx(_components.code,{children:`scripts/lib/get-config.js`})}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`scripts/image-assets.config.js`}),` (edit this)`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`If using the npm package, Sharp is listed as a peer dependency — install it alongside:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`pnpm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` add -D @nometria-ai/img-opt sharp`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# or`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`npm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` install --save-dev @nometria-ai/img-opt sharp`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Add scripts to `,_jsx(_components.code,{children:`package.json`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"scripts\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"images\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"node scripts/images-download-compress-replace.js\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"images:download\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"node scripts/download-images.js\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"images:compress\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"node scripts/compress-images.js\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"images:replace-urls\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"node scripts/replace-image-urls.js\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`configuration`,children:`Configuration`}),`\n`,_jsxs(_components.p,{children:[`Edit `,_jsx(_components.code,{children:`scripts/image-assets.config.js`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`21`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`21`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` default`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Where to save downloaded images`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` imagesDir: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'public/images'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // External image URLs to download`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Supports Unsplash, any direct image URL`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sources: [`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'https://images.unsplash.com/photo-1518770660439-4636190af475?w=1200'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'https://images.unsplash.com/photo-1555099962-4199c345e5dd?w=1200'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // ... add all external image URLs your app uses`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Directories to search when replacing URLs`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` replaceInDirs: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'src'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'public'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Compression options`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` compress: {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` quality: 82, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// WebP quality (0-100). 82 is a good balance.`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` removeOriginals: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`true`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Delete PNG/JPG after converting to WebP`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`usage`,children:`Usage`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Run all three steps at once (recommended)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`pnpm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` run images`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Or run steps individually`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`pnpm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` run images:download `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Step 1: download externals to public/images/`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`pnpm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` run images:compress `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Step 2: convert to WebP, delete originals`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`pnpm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` run images:replace-urls `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Step 3: update URLs in source code`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`example-output`,children:`Example output`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`16`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`16`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`$ `}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`pnpm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` run images`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`Downloading images...`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` https://images.unsplash.com/photo-1518770... → public/images/photo-1518770660439.jpg ✓ (284 KB)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` https://images.unsplash.com/photo-1555099... → public/images/photo-1555099962.jpg ✓ (198 KB)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Downloaded 2 images.`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`Compressing images...`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` photo-1518770660439.jpg → photo-1518770660439.webp... OK (41.2 KB)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` photo-1555099962.jpg → photo-1555099962.webp... OK (28.7 KB)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Done. WebP files `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` public/images/`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`Replacing URLs `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` source...`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` src/pages/Home.jsx: 3 replacements`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` src/components/Hero.jsx: 1 replacement`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Done. 4 replacements across 2 files.`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Before`}),` (slow — image served from Unsplash CDN):`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`jsx`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`jsx`,children:_jsxs(_components.code,{language:`jsx`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`img`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` src`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://images.unsplash.com/photo-1518770660439-4636190af475?w=1200\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` />`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`After`}),` (fast — local WebP, served from your own host):`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`jsx`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`jsx`,children:_jsxs(_components.code,{language:`jsx`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`img`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` src`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"/images/photo-1518770660439.webp\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` />`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`why-webp`,children:`Why WebP?`}),`\n`,_jsx(_components.p,{children:`WebP provides 25–35% smaller file sizes compared to JPEG at equivalent visual quality, and 25–50% smaller than PNG for images with transparency. All modern browsers support WebP.`}),`\n`,_jsxs(_components.p,{children:[`The default quality setting of `,_jsx(_components.strong,{children:`82`}),` is a good balance — noticeably smaller than JPEG at 90, with no visible quality difference at screen resolution.`]}),`\n`,_jsx(Heading,{level:`2`,id:`custom-config-path`,children:`Custom config path`}),`\n`,_jsxs(_components.p,{children:[`If you want to keep the config outside `,_jsx(_components.code,{children:`scripts/`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`IMAGE_ASSETS_CONFIG=./my-config.js `}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`pnpm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` run images`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`integrating-into-your-deploy-workflow`,children:`Integrating into your deploy workflow`}),`\n`,_jsx(_components.p,{children:`Add image optimization as a pre-build step so it runs before every deployment:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"scripts\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"prebuild\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"pnpm run images\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"build\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"vite build\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Or run it manually when you add new images to your project, rather than on every build (since images don’t change often).`}),`\n`,_jsx(Heading,{level:`2`,id:`source-files`,children:`Source files`}),`\n`,_jsxs(_components.p,{children:[`The package is available on `,_jsx(_components.a,{href:`https://www.npmjs.com/package/@nometria-ai/img-opt`,children:`npm`}),` and the source is on `,_jsx(_components.a,{href:`https://github.com/nometria/img-opt`,children:`GitHub`}),`. The same scripts are embedded as templates in Nometria-generated projects.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Image Compression Pipeline","description":"Open source scripts to download external images, compress them to WebP, and replace URLs across your codebase.","keywords":"image optimization, webp compression, image pipeline, download images, vite image optimization, nextjs images, sharp webp, image url rewrite, open source image tool, frontend performance","href":"/tools/image-pipeline"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"What it does","slug":"what-it-does","depth":2,"children":[]},{"title":"Installation","slug":"installation","depth":2,"children":[]},{"title":"Configuration","slug":"configuration","depth":2,"children":[]},{"title":"Usage","slug":"usage","depth":2,"children":[]},{"title":"Example output","slug":"example-output","depth":2,"children":[]},{"title":"Why WebP?","slug":"why-webp","depth":2,"children":[]},{"title":"Custom config path","slug":"custom-config-path","depth":2,"children":[]},{"title":"Integrating into your deploy workflow","slug":"integrating-into-your-deploy-workflow","depth":2,"children":[]},{"title":"Source files","slug":"source-files","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"nometria","siteName":"Nometria","title":"Image Compression Pipeline - Nometria","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-04-09T22:23:54.547Z","originalFileLocation":"tools/image-pipeline.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Open source scripts to download external images, compress them to WebP, and replace URLs across your codebase.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Nometria\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/nometria/w07jAppJ7FMONwC4/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/nometria/w07jAppJ7FMONwC4/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/nometria/w07jAppJ7FMONwC4/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/nometria/w07jAppJ7FMONwC4/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/nometria/w07jAppJ7FMONwC4/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/nometria/w07jAppJ7FMONwC4/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/nometria/w07jAppJ7FMONwC4/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/nometria/w07jAppJ7FMONwC4/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/nometria/w07jAppJ7FMONwC4/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Image Compression Pipeline - Nometria\">\u003cmeta data-mint-head property=\"og:description\" content=\"Open source scripts to download external images, compress them to WebP, and replace URLs across your codebase.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Nometria\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.nometria.com/tools/image-pipeline\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://nometria.mintlify.site/_mintlify/api/og/v2?division=npm+Packages\u0026amp;title=Image+Compression+Pipeline\u0026amp;description=Open+source+scripts+to+download+external+images%2C+compress+them+to+WebP%2C+and+replace+URLs+across+your+codebase.\u0026amp;theme=3feb1a497e8da9b8d819368d\u0026amp;signature=2c00fe45519bb1334c45c2396b7d19cf8be73ea5d694e2600dde73f56bfe7631\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Image Compression Pipeline - Nometria\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Open source scripts to download external images, compress them to WebP, and replace URLs across your codebase.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://nometria.mintlify.site/_mintlify/api/og/v2?division=npm+Packages\u0026amp;title=Image+Compression+Pipeline\u0026amp;description=Open+source+scripts+to+download+external+images%2C+compress+them+to+WebP%2C+and+replace+URLs+across+your+codebase.\u0026amp;theme=3feb1a497e8da9b8d819368d\u0026amp;signature=2c00fe45519bb1334c45c2396b7d19cf8be73ea5d694e2600dde73f56bfe7631\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/nometria/w07jAppJ7FMONwC4/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Nometria\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#dac99d\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.nometria.com/tools/image-pipeline\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/tools/image-pipeline.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.nometria.com/#organization\",\"name\":\"Nometria\",\"url\":\"https://docs.nometria.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/nometria/427PYV9416J_hPzI/images/icon128.png?fit=max\u0026auto=format\u0026n=427PYV9416J_hPzI\u0026q=85\u0026s=db2ab2fb3995383d0debd8114b4906fe\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.nometria.com#website\",\"name\":\"Nometria\",\"url\":\"https://docs.nometria.com\",\"publisher\":{\"@id\":\"https://docs.nometria.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.nometria.com/tools/image-pipeline#webpage\",\"url\":\"https://docs.nometria.com/tools/image-pipeline\",\"name\":\"Image Compression Pipeline\",\"description\":\"Open source scripts to download external images, compress them to WebP, and replace URLs across your codebase.\",\"dateModified\":\"2026-04-09T22:23:54.547Z\",\"isPartOf\":{\"@id\":\"https://docs.nometria.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.nometria.com/tools/image-pipeline#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.nometria.com/tools/image-pipeline#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Nometria\",\"item\":\"https://docs.nometria.com\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Image Compression Pipeline\",\"item\":\"https://docs.nometria.com/tools/image-pipeline\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.nometria.com/tools/image-pipeline#article\",\"headline\":\"Image Compression Pipeline\",\"name\":\"Image Compression Pipeline\",\"description\":\"Open source scripts to download external images, compress them to WebP, and replace URLs across your codebase.\",\"url\":\"https://docs.nometria.com/tools/image-pipeline\",\"mainEntityOfPage\":{\"@id\":\"https://docs.nometria.com/tools/image-pipeline#webpage\"},\"dateModified\":\"2026-04-09T22:23:54.547Z\",\"publisher\":{\"@id\":\"https://docs.nometria.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.nometria.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Nometria\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Nometria\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/tools/image-pipeline.md","siteName":"Nometria","nav":{"global":{"anchors":[{"anchor":"Documentation","icon":"book-open-cover","href":"https://docs.nometria.com"},{"anchor":"Blog","icon":"newspaper","href":"https://nometria.com/blog"},{"anchor":"Free Tools","icon":"wrench","href":"https://nometria.com/tools"}]},"tabs":[{"tab":"Getting Started","pages":[{"title":"Getting Started","href":""}]},{"tab":"CLI \u0026 AI Tools","pages":[{"title":"CLI \u0026 AI Tools","href":"/cli/overview"}]},{"tab":"Two-Way Sync","pages":[{"title":"Two-Way Sync","href":"/sync/overview"}]},{"tab":"Migration Guides","pages":[{"title":"Migration Guides","href":"/migrate/base44-to-aws"}]},{"tab":"Partners","pages":[{"title":"Partners","href":"/partners/overview"}]},{"tab":"Open Source Tools","groups":[{"group":"Overview","pages":[{"title":"Free Tools \u0026 Open Source","href":"/tools/overview"}]},{"group":"Free Web Tools","pages":[{"title":"SEO Audit Tools","href":"/tools/seo-audit"},{"title":"Infrastructure Tools","href":"/tools/infrastructure"},{"title":"Vibe Coding Audits","href":"/tools/vibe-coding-audits"}]},{"group":"Developer Tools","pages":[{"title":"nom — Deploy CLI","icon":"terminal","href":"/tools/deploy-cli"},{"title":"Claude Code Plugin","description":"MCP server that lets Claude Code deploy, manage, and monitor your apps with natural language.","icon":"plug","href":"/tools/claude-code-plugin"}]},{"group":"npm Packages","pages":[{"title":"Image Compression Pipeline","href":"/tools/image-pipeline"},{"title":"Appwrite Migrate","description":"Schema-driven migration runner for Appwrite — the missing prisma migrate for Appwrite projects.","href":"/tools/appwrite-migrate"},{"title":"Supabase Export","href":"/tools/supabase-export"},{"title":"SDK Upstream Sync","href":"/tools/sdk-upstream-sync"}]},{"group":"Python Packages","pages":[{"title":"Blog Generation Script","href":"/tools/generate-blogs"},{"title":"Growth Tools","href":"/tools/growth-tools"},{"title":"Build Fix Agents","href":"/tools/build-fix"},{"title":"App Auditor","href":"/tools/app-auditor"},{"title":"Manus to Supabase","href":"/tools/manus-to-supabase"},{"title":"Supabase Schemas","href":"/tools/supabase-schemas"},{"title":"Security Scanner","href":"/tools/security-scanner"},{"title":"Screen Recorder Analyzer","href":"/tools/screen-recorder-analyzer"},{"title":"Medical OCR","href":"/tools/medical-ocr"}]}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/introduction"}]}]},"basePath":"","title":"Image Compression Pipeline - Nometria","deploymentId":"dpl_HhUetB7eHHDAmK9T1Teip38TgFx9","buildId":"dpl_HhUetB7eHHDAmK9T1Teip38TgFx9","dynamics":[],"chunks":[]}