optimo — Media Compression Commands

Get SKILL.mdOPTIMO

effortless media
optimizer for the web

Free, open-source CLI that optimizes and converts images and videos using format-specific compression built on ImageMagick and FFmpeg.

>optimopublic/
[-15.4 KB]examples/banner.heic
[-34.5 KB]examples/banner.jpg
[-22.9 KB]examples/banner.png
[-132 B]examples/banner.tiff
[-5.7 KB]examples/banner.webp

Why we built Optimo

Kiko Beats

At Microlink, we deal with images. A lot of them.

They add up. Disk space goes first. Bandwidth follows. Then everything gets slower than it should be.

So we tried optimized them. Like everyone does. A mix of tools, flags, and formats.

Sometimes it worked. Other times, not so much.

We didn't find a consistent solution.

We weren't looking for perfect. Just something that works every time, without thinking about it.

So we built Optimo.

It takes images and videos and makes them smaller. Less storage, faster transfers, no surprises.

Nothing fancy. Just does the job.

PS: Follow me on Twitter please.

Image Formats

PNG, JPEG, WebP, AVIF, HEIC, JXL, GIF, SVG — each with simple, format-specific commands made for the web.

PNG
JPEG
WebP
AVIF
HEIC
JXL
GIF
SVG

Video Formats

MP4, WebM, MOV, MKV, AVI, OGV — FFmpeg-powered compression with sensible web defaults out of the box.

MP4
WebM
MOV
MKV
AVI
OGV

Resize Options

Scale by percentage, target a specific file size, or constrain by width or height. All in one flag.

# resize image to 50 percent then optimize
npx optimo img.png --resize 50% 

# resize image to target max file size
npx optimo img.png --resize 100kB 

# resize image to max width of 960px
npx optimo img.png --resize w960

# resize image to max height of 480px 
npx optimo img.png --resize h480

Lossy + Lossless

Lossless compression by default preserves quality. Enable lossy mode when you need maximum compression.

# default (lossless)
npx optimo image.png

# lossy mode for max compression
npx optimo image.jpg --lossy

Dry Run Mode

Preview exactly what would change without modifying any files. Perfect for CI checks and testing.

# It is not modifying files;
# just showing what would change
npx optimo public/ --dry-run

Git Pre-Commit

Auto-optimize images and videos before every commit. Pair with nano-staged so only staged assets get processed.

# package.json
{
  "simple-git-hooks": {
    "pre-commit": "npx nano-staged"
  },
  "nano-staged": {
    "*.{png,jpg,jpeg,webp,avif,heic,gif,svg}":
      "npx optimo",
    "*.{mp4,webm,mov}":
      "npx optimo"
  }
}

Batch Processing

Process entire directories recursively with a single command. Hidden files and unsupported formats are automatically skipped.

npx optimo public/media

 [-15.4 KB]  examples/banner.heic
 [-34.5 KB]  examples/banner.jpg
 [-22.9 KB]  examples/banner.png
   [-132 B]  examples/banner.tiff
  [-5.7 KB]  examples/banner.webp

Programmatic API

Use optimo in your Node.js scripts with full TypeScript support. Process single files or entire directories.

const optimo = require('optimo')

// Single file
await optimo.file('/path/image.jpg', {
  format: 'webp',
  resize: '50%',
  onLogs: console.log
})

// Entire directory
const result = await optimo.dir('/path/images')
// { originalSize, optimizedSize, savings }

CLI Options

Full control over your optimization steps with simple flags.

-d--dry-run

Show what would change without writing files

-f--format

Convert output format (jpeg, webp, avif, etc.)

-l--lossy

Enable lossy + lossless pass for maximum compression

-m--mute

Remove audio tracks from videos (default: true)

-r--resize

Resize using percentage, max file size, width, or height

-s--silent

Suppress per-file logs

-v--verbose

Print debug logs for format selection and errors

Battle-Tested Tools

optimo resolves compressors from your PATH and throws if required binaries are missing. Install the tools you need for your target formats.

FormatRequired Binary
All ImageMagick formatsmagick
SVG toolssvgo
JPEG second passmozjpegtran or jpegtran
GIF second passgifsicle
Video toolsffmpeg

Recommended Workflow

Follow these steps for reliable, predictable media optimization.

01

Dry Run First

Start with --dry-run to confirm target files without changes.

02

Test Single File

Run optimization on one file first, then scale to directories.

03

Convert Intentionally

Use --format only when format conversion is intended.

04

Resize Explicitly

Use --resize only when dimension or size control is required.

05

Debug Issues

Use --verbose when diagnosing unsupported files or binary issues.

06

Verify & Commit

Check outputs in version control before committing changes.

Frequently asked questions

What is optimo?
Optimo is a free, open-source CLI tool that optimizes and converts images and videos using format-specific compression pipelines built on ImageMagick and FFmpeg. It supports 15 media formats including PNG, JPEG, WebP, AVIF, HEIC, JPEG XL, GIF, SVG, MP4, WebM, MOV, MKV, AVI, and OGV.
How does optimo optimize images?
Optimo applies format-specific compression tuned for each file type. For images it uses ImageMagick, SVGO, Gifsicle, and MozJPEG. For videos it uses FFmpeg. It runs lossless optimization by default and keeps the original if the optimized output is not smaller.
What formats does optimo support?
Optimo supports 8 image formats (PNG, JPEG, WebP, AVIF, HEIC, JPEG XL, GIF, SVG) and 6 video formats (MP4, WebM, MOV, MKV, AVI, OGV). Each format has a dedicated compression pipeline with sensible defaults.
Is optimo free?
Yes. Optimo is completely free and open-source under the MIT license. Install it with npx optimo or npm install optimo.
How do I install optimo?
No installation required — just run "npx optimo" followed by a file or directory path. For permanent installation, use "npm install -g optimo".
Does optimo work on Windows, macOS, and Linux?
Yes. Optimo runs on macOS, Linux, and Windows wherever Node.js, ImageMagick, and FFmpeg are available.