mirror of
https://github.com/TolgaNogay/lightimg.git
synced 2026-04-26 16:25:53 +03:00
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.
| dist | ||
| node_modules | ||
| src | ||
| test_images | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
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.
🚀 Features
- 📂 Flexible Scanning: Select any directory via interactive prompt or CLI argument.
- 🔄 Smart Conversion: Automatically converts
png,jpg,jpeg,avif, andtiffto WebP. - 📁 Organized Output: Creates an
/optimizedfolder 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
- Scan: Recursively looks for images while ignoring
node_modulesand alreadyoptimizedfolders. - Filter: Identifies supported formats (
.jpg,.png, etc.). - Convert: Uses the high-performance Sharp engine to convert to WebP with a default quality of
80. - 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