optimo
Original:🇺🇸 English
Translated
Optimize and convert images using the optimo CLI and API on top of ImageMagick. Use when the user mentions reducing image size, image compression, batch image optimization, converting formats (jpeg/png/webp/avif/heic/jxl), resizing by percentage/dimensions/max-size, or running optimo in scripts.
2installs
Sourcemicrolinkhq/skills
Added on
NPX Install
npx skill4agent add microlinkhq/skills optimoTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →optimo
optimoPrerequisites
optimoPATHRequired by format:
- all ImageMagick-backed formats:
magick - SVG pipeline:
svgo - JPEG second pass: or
mozjpegtranjpegtran - GIF second pass:
gifsicle
Quick Start (CLI)
Use for one-off runs:
npxbash
npx -y optimo public/mediaOptimize a single file:
bash
npx -y optimo public/media/banner.pngRun a dry run (no file changes):
bash
npx -y optimo public/media/banner.png --dry-run # long version
npx -y optimo public/media/banner.png -d # short versionEnable lossy mode:
bash
npx -y optimo public/media/banner.jpg --losy # long version
npx -y optimo public/media/banner.jpg -l # short versionConvert and optimize to a new format:
bash
npx -y optimo public/media/banner.png --format jpeg # long version
npx -y optimo public/media/banner.png -f jpeg # short versionResize by percentage:
bash
npx -y optimo public/media/banner.png --resize 50% # long version
npx -y optimo public/media/banner.png -r 50% # short versionResize to a target max file size:
bash
npx -y optimo public/media/banner.png --resize 100kB # long version
npx -y optimo public/media/banner.png -r 100kB # short versionResize by width:
bash
npx -y optimo public/media/banner.png --resize w960 # long version
npx -y optimo public/media/banner.png -r w960 # short versionResize by height:
bash
npx -y optimo public/media/banner.png --resize h480 # long version
npx -y optimo public/media/banner.png -r h480 # short versionEnable verbose debugging:
bash
npx -y optimo public/media/banner.heic --dry-run --verbose # long version
npx -y optimo public/media/banner.heic -d -v # short versionPipelines
optimo- ->
.pngmagick.png - ->
.svgsvgo.svg - ->
.jpg/.jpeg+magick.jpg/jpegmozjpegtran.jpg/jpeg - ->
.gif+magick.gifgifsicle.gif - other formats (,
webp,avif,heic,heif, etc.) ->jxlmagick.<format>
Mode behavior:
- default: lossless-first pipeline
- /
--losy: lossy + lossless pass where supported-l
Recommended Workflow
- Start with to confirm target files.
--dry-run - Run optimization on one file first, then scale to directories.
- Use only when conversion is intended.
--format - Use only when explicit dimension/size control is required.
--resize - Use when diagnosing unsupported files or binary/flag issues.
--verbose - Verify outputs in version control before committing.
CLI Options
- ,
-d: Show what would change without writing files.--dry-run - ,
-f: Convert output format (--format,jpeg,webp, etc.).avif - ,
-l: Enable lossy + lossless pass.--losy - ,
-r: Resize using percentage (--resize), max file size (50%), width (100kB), or height (w960).h480 - ,
-s: Suppress per-file logs.--silent - ,
-v: Print debug logs (pipeline selection, command execution, and errors).--verbose
Programmatic API
js
const optimo = require('optimo')
await optimo.file('/absolute/path/image.jpg', {
dryRun: false,
losy: false,
format: 'webp',
resize: '50%',
onLogs: console.log
})
await optimo.file('/absolute/path/image.jpg', {
resize: '100kB',
onLogs: console.log
})
await optimo.file('/absolute/path/image.jpg', {
resize: 'w960',
onLogs: console.log
})
const result = await optimo.dir('/absolute/path/images')
console.log(result)
// { originalSize, optimizedSize, savings }Behavior Notes
- For non-conversion runs, if the optimized file is not smaller, the original file is kept.
- During conversion, output uses the new extension and the original source file is removed (unless ).
--dry-run - Hidden files and folders (names starting with ) are skipped in directory mode.
. - Unsupported files are reported as and ignored.
[unsupported]