A lightweight, framework-agnostic CLI tool that converts and optimizes your images to WebP format. Perfect for Next.js, Astro, Go, or any other web project where performance matters.
Find a file
2026-02-27 11:44:52 +03:00
dist Initial commit: lightimg CLI tool 2026-02-27 11:30:00 +03:00
node_modules Initial commit: lightimg CLI tool 2026-02-27 11:30:00 +03:00
src Initial commit: lightimg CLI tool 2026-02-27 11:30:00 +03:00
test_images Initial commit: lightimg CLI tool 2026-02-27 11:30:00 +03:00
package-lock.json Initial commit: lightimg CLI tool 2026-02-27 11:30:00 +03:00
package.json chore: reset version to 0.0.1 2026-02-27 11:44:52 +03:00
README.md docs: update package name to @tolganogayy/lightimg and increment version 2026-02-27 11:42:58 +03:00
tsconfig.json Initial commit: lightimg CLI tool 2026-02-27 11:30:00 +03:00

lightimg 🖼️

A lightweight, framework-agnostic CLI tool that converts and optimizes your images to WebP format. Perfect for Next.js, Astro, Go, or any other web project where performance matters.

npm version License: MIT

🚀 Features

  • 📂 Flexible Scanning: Select any directory via interactive prompt or CLI argument.
  • 🔄 Smart Conversion: Automatically converts png, jpg, jpeg, avif, and tiff to WebP.
  • 📁 Organized Output: Creates an /optimized folder to keep your originals safe.
  • Framework Independent: Works anywhere—Next.js, Astro, Go, Hugo, or plain HTML.
  • 🧠 Robust Processing: Gracefully skips corrupted files and keeps going.
  • 📊 Insightful Feedback: Shows exactly how much disk space you saved.

📦 Installation

You can run it instantly without installation:

npx @tolganogayy/lightimg

Or install it globally for frequent use:

npm install -g @tolganogayy/lightimg

🛠️ Usage

Interactive Mode

Run the command and follow the beautiful prompts:

lightimg

Direct Mode

Pass the target directory path as an argument:

lightimg ./public/images

🧠 How it Works

  1. Scan: Recursively looks for images while ignoring node_modules and already optimized folders.
  2. Filter: Identifies supported formats (.jpg, .png, etc.).
  3. Convert: Uses the high-performance Sharp engine to convert to WebP with a default quality of 80.
  4. Report: Summarizes the number of files processed and the total size reduction.

🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

📄 License

This project is MIT licensed.


Made with ❤️ by Tolga Nogay