Installation
imgsqz requires Node.js 18 or newer. Check your version first:
node --version# v18.0.0 or higherGlobal install (recommended)
Section titled “Global install (recommended)”A global install puts the imgsqz command on your PATH so you can run it from
anywhere.
npm install -g @wdalhaj/imgsqzpnpm add -g @wdalhaj/imgsqzyarn global add @wdalhaj/imgsqzbun add -g @wdalhaj/imgsqzVerify the install:
imgsqz --version# 1.0.1
imgsqz --helpRun without installing (npx)
Section titled “Run without installing (npx)”For a one-off, or in CI, skip the install entirely:
npx @wdalhaj/imgsqz photo.png -f webp -q 70npx downloads the package, runs it, and caches it. Great for trying imgsqz or
pinning a version in a script:
npx @wdalhaj/imgsqz@1.0.1 photo.pngPer-project install
Section titled “Per-project install”If you want imgsqz pinned in a repo (for a reproducible optimization script):
npm install --save-dev @wdalhaj/imgsqzpnpm add -D @wdalhaj/imgsqzyarn add -D @wdalhaj/imgsqzbun add -d @wdalhaj/imgsqzThen call it from an npm script in package.json:
{ "scripts": { "optimize": "imgsqz public/img/*.png -f webp -q 75" }}npm run optimizeUpgrading
Section titled “Upgrading”npm update -g @wdalhaj/imgsqzpnpm update -g @wdalhaj/imgsqzyarn global upgrade @wdalhaj/imgsqzbun update -g @wdalhaj/imgsqzUninstalling
Section titled “Uninstalling”npm uninstall -g @wdalhaj/imgsqzInstalled? Continue to the Quick start.