
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
High-performance image optimization CLI with modern format support, bulk processing, and presets for developers
High-performance image optimization CLI. Modern formats, bulk directory processing, presets, and safe defaults.
optimg ./images --bulk --preset balanced --yes
# For one-off runs without global install:
npx optimg ./images --bulk --preset balanced --yes
Global (primary)
npm install -g optimg-cli
optimg --help
which optimg (macOS/Linux) or where optimg (Windows)Local (project dev dependency)
npm install optimg-cli --save-dev
Add to package.json scripts:
{
"scripts": {
"optimize": "optimg ./images --bulk --preset balanced"
}
}
npx (one-off usage)
npx optimg --help
npx optimg ./images --bulk --preset balanced --yes
Requirements
>=18.0.0libvips/build tools.Single file
optimg photo.jpg # WebP by default
optimg photo.jpg --quality 90
optimg photo.png --width 800 --format jpeg
optimg texture.jpg --resize 1/2 # ratio
optimg photo.jpg --percent 25 # percentage
optimg input.jpg -o output.webp # explicit output
Directory (bulk)
optimg ./images --bulk # creates ./optimized*
optimg ./assets --bulk --format webp --quality 75 --parallel 8
optimg ./images --bulk -o ./optimized/ # custom output root
Defaults
webp80true (WebP/AVIF support lossless)stripMetadata: false)true4Bulk output
--bulk: writes into optimized, then optimized1, optimized2, …; skips any optimized* inputs--bulk-inplace: writes next to originals; suffix -optimized unless --delete-originalsSeparate folder (--bulk)
optimized*optimized/optimized/...optimg ./images --bulk
optimg ./images --bulk --yes
In-place (--bulk-inplace)
optimized* directoriesname-optimized.<ext>--delete-originals: name.<ext> replaces originaljpeg, jpg, png, webp, gif, tiff, svg, heic, avifwebp, jpeg, jpg, png, avifBefore → After (nested folders)
assets/
ui/icon.png
photos/sample.jpg
assets/
ui/icon-optimized.webp
ui/icon.png
photos/sample-optimized.webp
photos/sample.jpg
Examples
optimg ./assets --bulk-inplace --preset balanced --yes
optimg ./assets --bulk-inplace --delete-originals --format webp --quality 80 --yes # not on Windows
optimg ./assets --bulk-inplace --format webp --no-lossless --quality 80 --yes # lossy WebP
Error handling
EACCES,EPERM) → write to a directory you ownENOSPC) → free space or change output location--delete-originals (not supported)Input/Output
optimg <input> # file or directory
optimg <input> -o <output> # explicit output path/dir
Format & Quality
optimg <input> --format webp # webp, jpeg, png, avif
optimg <input> --quality 85 # 0–100 (default 80)
optimg <input> --lossless # enable lossless
optimg <input> --loseless # alias
optimg <input> --no-lossless # disable lossless
Resizing
optimg <input> --width 800
optimg <input> --height 600
optimg <input> --resize 1/2
optimg <input> --percent 50
Presets
optimg <input> --preset quality # default, balanced, quality, performant
optimg preset # list presets
optimg formats # list formats
Bulk / parallel / config / verbose
optimg <dir> --bulk
optimg <dir> --bulk-inplace
optimg <dir> --bulk --parallel 8
optimg <input> --strip-metadata
optimg <input> --config ./config.json
optimg <input> --verbose
optimg <input> --yes
1/2, 1/4) to keep texture sets consistent (4K→2K→1K)--delete-originalsoptimg ./textures/4k --bulk --resize 1/2 --format webp --quality 90
optimg ./textures/2k --bulk --resize 1/2 --format webp --quality 80
optimg ./textures/final --bulk --resize 1/2 --preset performant
stripMetadata: false)--strip-metadata for privacy or maximal size reductionoptimg ./photos --bulk --strip-metadata
Windows
--delete-originals is not supported due to file locking behavior--bulk or --bulk-inplace without deletion and clean up manuallyLinux/macOS
LICENSEFAQs
High-performance image optimization CLI with modern format support, bulk processing, and presets for developers
We found that optimg-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.