fast-image-converter

A lightweight, cross-platform image conversion and compression utility built on Sharp with CLI and Node.js API support.


The Idea

fast-image-converter is a minimal image conversion utility built on Sharp for Node.js and TypeScript. It converts and compresses images in bulk—via CLI or programmatic API—with no unnecessary overhead. Whether you're optimizing assets for the web or automating image pipelines, fast-image-converter handles batch processing with configurable quality, resizing, and format conversion in a single lightweight package.


What It Offers

Format Conversion

Broad input support with targeted output formats:

  • Input: JPG, PNG, WebP, GIF, AVIF, TIFF, SVG, and HEIF
  • Output: JPG or WebP
  • Quality control: Configurable compression from 1–100 (default: 85)

Smart Processing

Flexible options for any workflow:

  • Resizing: Shrink images while preserving aspect ratio using a maximum pixel constraint
  • Recursive scanning: Process nested folder structures in one pass
  • Parallel processing: Adjustable concurrency for fast batch operations
  • Git integration: Optionally process only untracked files

Dual Interface

Use however fits your workflow:

  • CLI: Simple flags for path, format, quality, output directory, and more
  • Node.js / TypeScript API: convertImages() for programmatic use in scripts or build tools

File Management

  • Keep or delete source files after conversion
  • Output to a separate directory or convert in place

Key Features

  • Minimal footprint: 10.8 KB total package size
  • Sharp-powered: Fast, production-grade image processing
  • TypeScript support: First-class types for the programmatic API
  • Batch-friendly: Concurrency control prevents resource exhaustion on large sets
  • Git-aware: --untracked flag limits processing to new, uncommitted files

Why Choose fast-image-converter

  • No bloat—just the essential options for real image pipelines
  • Works with both CLI workflows and Node.js build scripts
  • Handles recursive directories without extra tooling
  • Ideal for pre-commit hooks, CI/CD asset optimization, and local batch jobs
  • Single command or single function call to process an entire folder

FAQs

  • Why not use Sharp directly? Sharp is a low-level library. fast-image-converter wraps it with a CLI and sensible defaults so you don't have to write boilerplate for every project.
  • What Node.js version is required? Node.js 18 or higher.
  • Can I convert without installing? Yes—run directly with npx fast-image-converter.
  • How do I limit output size? Use --max-size to set a maximum pixel dimension; aspect ratio is preserved automatically.
  • Does it support AVIF output? Currently outputs JPG or WebP. AVIF and other formats are supported as input.

Tech

Built with Node.js, TypeScript, and Sharp for image processing. Supports CLI usage via argument parsing and a programmatic API for integration into Node.js scripts and build pipelines.