Bulki README

The full upstream README, mirrored for reference. Install config, tool schemas, adoption signals and our own overview live on the Bulki listing page.

@puntoycoma/bulki

The image optimizer that works the way you do — interactively, automatically, or as a tool your AI editor calls for you.

npm version license CI

Compress, resize, and convert JPEG, PNG, WebP, GIF, and AVIF images in bulk. Powered by Sharp (libvips) — 4-5x faster than ImageMagick.

Free. Open source. No API keys. Runs 100% locally.

Terminal
npm install -g @puntoycoma/bulki

At a glance

FeatureWhat it doesCommand
CompressOptimize images with quality, format, and resize controlbulki compress ./photos -f webp -q 80
InteractiveGuided menu with presets — no flags to memorizebulki
WatchMonitor a folder and auto-optimize new imagesbulki watch ./uploads -f webp
PipeRead from stdin, write to stdout — compose with any toolcat img.jpg | bulki pipe -f webp > out.webp
Git hookAuto-optimize images on every commitbulki hook install
MCP serverLet AI editors (Claude Code, Cursor) call bulki directlybulki mcp
JSON outputMachine-readable results for scripts and CI/CDbulki compress ./imgs --json
Size budgetFail if any image exceeds a size limitbulki compress ./imgs --max-size 200kb

Quick start

Interactive mode

bash
bulki

Guided step-by-step mode. Drag a folder (or several images) into the terminal window when it asks for a path — quotes, escaped spaces and trailing spaces are handled for you. You can also start it with a path: bulki ~/Desktop/My\ Photos.

Presets:

  • Web optimized — WebP, quality 80, max 1920px wide
  • Social media — JPEG, quality 85, max 1080px wide
  • Just make them smaller — same format and size, quality 80
  • Custom — you choose format, quality and size

Navigation: Esc goes back one step (nothing you chose is lost), Ctrl+C quits. A wrong path or number is rejected in place so you can fix it. Before starting you get a summary where you can change the images, settings or output folder; afterwards you can open the output folder or run again with different settings.

CLI mode

bash
bulki compress ./photos                         # → ./bulki-output
bulki compress ./photos -o ./web -f webp -q 80  # convert to WebP into ./web
bulki compress "My Photos" -o "Web Ready" -r 1920
bulki compress hero.png logo.png -f avif        # several files at once (globs work too)

Compress

Optimize files and/or folders. Originals are never modified — optimized copies are written to the output folder, mirroring the folder structure.

bash
bulki compress <paths...> [options]
OptionAliasDescriptionDefault
--output <dir>-oFolder where optimized images are written./bulki-output
--quality <n>-qOutput quality (1-100)70
--format <fmt>-fjpeg, png, webp, gif, avifkeep original
--resize <width>-rMax width in pixels (never enlarges)original
--concurrency <n>Images processed in parallel (1-32)CPU count (max 8)
--exclude <names...>Folder names to skipnone
--dry-runShow what would be written, without writingfalse
--verboseOne line per filefalse
--jsonMachine-readable JSON outputfalse
--max-size <size>Fail if output exceeds limit (e.g., 200kb, 1mb)none

The path you want to optimize is the argument (bulki compress <path>); -o is only where the results go. Paths with spaces must be quoted ("My Photos") or escaped (My\ Photos) — or just drag the folder into the terminal.

Upgrading from 3.0? -d/--destination <dir> and --output-folder <name> still work (-d x → x/bulki-output, -d x -o name → x/name) but are deprecated in favor of -o <dir>.

Behaviour worth knowing:

  • Previous bulki-output folders inside the source are skipped, so running twice doesn't nest outputs.
  • If re-encoding would make an image bigger, the original bytes are copied instead.
  • EXIF orientation is applied (phone photos won't come out sideways); transparent PNG → JPEG gets a white background.
  • photo.jpg and photo.png converted to WebP become photo.webp and photo-png.webp (nothing is silently overwritten).
  • HEIC/HEIF photos (iPhone) are converted on macOS.
  • A broken image doesn't stop the batch: it's reported at the end and the exit code is 1.

Output preserves your folder structure:

Code
photos/                    bulki-output/
  vacation/         ->       vacation/
    beach.jpg                  beach.jpg
    sunset.png                 sunset.png

Examples

bash
# Optimize for web: WebP, quality 80, max 1920px
bulki compress ./public -f webp -q 80 -r 1920

# Preview what would be processed without writing anything
bulki compress ./uploads --dry-run

# Get JSON results for a script
bulki compress ./images --json

# Fail in CI if any image exceeds 200 KB
bulki compress ./assets --max-size 200kb

JSON output

bash
bulki compress ./images --json
config.json
{
  "files": [
    {
      "input": "photo.jpg",
      "output": "bulki-output/photo.webp",
      "originalSize": 2400000,
      "newSize": 680000,
      "reduction": 72,
      "format": "webp"
    }
  ],
  "summary": {
    "totalFiles": 1,
    "totalOriginalSize": 2400000,
    "totalNewSize": 680000,
    "totalReduction": 72,
    "errors": 0
  }
}

Watch

Monitor a directory. Every time a new image appears, bulki optimizes it automatically. Runs until you press Ctrl+C.

bash
bulki watch <directory> [options]

Same options as compress: --output, --quality, --format, --resize. Files are processed once they stop changing (large copies aren't read half-written), and edits to an existing image are re-optimized.

Examples

bash
# Watch uploads and convert everything to WebP
bulki watch ./uploads -f webp -q 80

# Watch with resize, output to a different folder
bulki watch ./photos -r 1920 -q 85 -o ./optimized

Use cases

  • Photographers — import photos from camera to a folder, get optimized versions automatically
  • Designers — export from Figma or Sketch, images optimize as they save
  • Upload servers — monitor /var/uploads and serve optimized versions from /var/optimized
  • Content teams — shared folder where anyone drops images and they come out ready for web

Pipe

Read an image from stdin, optimize it, write the result to stdout. No files on disk.

bash
bulki pipe -f <format> [-q quality] [-r width]

Examples

bash
# Download and optimize in one command
curl -s https://example.com/photo.jpg | bulki pipe -f webp -q 80 > photo.webp

# Convert format on the fly
cat input.png | bulki pipe -f avif -q 70 > output.avif

# Optimize and upload to S3 without saving locally
cat photo.jpg | bulki pipe -f webp -r 800 | aws s3 cp - s3://bucket/photo.webp

Use cases

  • CI/CD pipelines — optimize images during build without temp files
  • Shell scripts — compose with curl, aws, gsutil, scp, or any Unix tool
  • Webhooks — receive an image from an HTTP request, optimize, forward

Git hook

Install a pre-commit hook that auto-optimizes every image you commit. One command. Works for the entire team.

bash
bulki hook install       # add the hook
bulki hook uninstall     # remove it

How it works

  1. You run bulki hook install once in your repo
  2. Every time someone runs git commit with staged image files (JPEG, PNG, WebP, GIF, AVIF), bulki optimizes them before the commit completes
  3. The optimized version replaces the original in the commit
  4. No manual step — it just works

Use cases

  • Teams — ensure no one ever commits unoptimized images
  • Repository health — keep your repo lean without manual work
  • Faster CI/CD — smaller images in the repo = faster clones, builds, and deploys

MCP server (AI editor integration)

bulki includes a built-in MCP server. AI coding assistants call bulki directly — no shell commands, no copy-paste.

Runs 100% locally. No API keys. No internet required.

Works with Claude Code, Cursor, Windsurf, Cline, and any MCP-compatible editor.

bash
bulki mcp

Setup

Add to your editor's MCP config:

Claude Code (~/.claude.json or project .mcp.json):

config.json
{
  "mcpServers": {
    "bulki": {
      "command": "npx",
      "args": ["@puntoycoma/bulki", "mcp"]
    }
  }
}

Cursor (.cursor/mcp.json):

config.json
{
  "mcpServers": {
    "bulki": {
      "command": "npx",
      "args": ["@puntoycoma/bulki", "mcp"]
    }
  }
}

Then ask your AI:

"Optimize all images in the project for web" "Convert the PNG files in /public to WebP" "Check if any image in /assets is larger than 200kb"

Available tools

ToolDescription
compressOptimize images with format, quality, resize, and size budget options
detectIdentify if a file is an image and return its format

Integration examples

npm scripts

config.json
{
  "scripts": {
    "images": "bulki compress ./src/assets -f webp -q 80",
    "images:check": "bulki compress ./public --max-size 200kb --dry-run"
  }
}

GitHub Actions

yaml
- name: Optimize images
  run: npx @puntoycoma/bulki compress ./public -f webp -q 80 --max-size 500kb

CI pipeline with JSON

bash
result=$(bulki compress ./dist/images --json --max-size 300kb)
echo "$result" | jq '.summary.totalReduction'

Supported formats

FormatCompressConvert toConvert from
JPEGyesyesyes
PNGyesyesyes
WebPyesyesyes
GIF (animated)yesyesyes
AVIFyesyesyes

Requirements

  • Node.js >= 20.9

FAQ

How do I convert images to WebP from the command line? bulki compress ./images -f webp -q 80

What's the best free alternative to TinyPNG? bulki — runs locally, no file limits, no API keys. bulki compress ./photos -q 80

How do I optimize images for web performance? bulki compress ./public -f webp -q 80 -r 1920 --max-size 500kb

How do I auto-optimize images in my project? bulki hook install for git commits, or bulki watch ./uploads for a live folder.

Can AI editors optimize images? Yes. Add bulki as an MCP server to Claude Code, Cursor, or Windsurf. Ask: "optimize the images in /public".

What formats does bulki support? JPEG, PNG, WebP, GIF (animated), and AVIF. Compression and conversion between all formats.

Is imagemin still maintained? No. imagemin and its plugins are deprecated. bulki is a modern, maintained alternative.

License

AGPL-3.0 — free to use, modify, and distribute. All derivatives must remain open source under the same license. See LICENSE for details.

Contributing

Issues and PRs welcome at github.com/PuntoyComaTech/bulki.


Developed by PuntoyComaTech

Instagram X YouTube TikTok LinkedIn

A free tool for developers, designers, and teams who care about performance.