reduceify
v1.0.1
Published
A powerful and interactive CLI tool to compress and convert images (JPEG, PNG, WebP, AVIF) recursively, preserving folder structure.
Maintainers
Readme
Reduceify
A powerful and interactive command-line interface (CLI) tool brought to you by Kolibri Web Designs. Reduceify helps you optimize your website's performance by compressing and converting images (JPEG, PNG, WebP, AVIF) recursively while preserving your original folder structure.
Say goodbye to manual image optimization and hello to faster page loads!
✨ Features
- Recursive Processing: Automatically scans and processes images within all subfolders, maintaining the exact directory structure in the output.
- Multiple Output Formats: Convert images to modern, highly-optimized formats like WebP or AVIF, or simply compress them in their original format.
- Interactive Prompts: User-friendly command-line interface to choose input/output directories and compression quality.
- Smart Compression: Leverages
sharpfor high-performance image processing. - Bun.js Optimized: Built with Bun for blazing-fast execution.
- Detailed Output: Provides real-time feedback on compression progress and file size reduction.
🚀 Installation & Usage
Prerequisites
Global Installation (Recommended for frequent use)
To use reduceify as a global command from any directory:
- Make sure you have
buninstalled. - Open your terminal and run:
bun install -g reduceify - You can now run
reduceifyfrom any project folder:reduceify
Using with npx (No global installation needed)
If you prefer not to install globally, you can use npx to run it directly:
npx reduceifynpx will download and execute the latest version of reduceify on demand.
Running the Tool
Once installed (or via npx), simply navigate to your project directory in the terminal and run:
reduceifyYou will then be guided by interactive prompts:
- Enter the input directory: Specify the folder containing your images (e.g.,
public/images,assets). Relative to your current terminal location. - Enter the output directory: Choose where the processed images should be saved (e.g.,
public/compressed-images). - Choose the output format: Select
original(for compression only),webp, oravif. - Enter the image quality (1-100): Define the compression level.
The tool will then scan for images, process them, and output them to the specified directory while maintaining your original folder structure.
⚠️ Important Notes
- Existing AVIF/WebP input: The tool will also detect and re-process existing
.avifor.webpfiles in your input directory. If you choose "original" output format, they will be compressed/copied as their original type. If you choose "webp" or "avif" output, they will be converted to the chosen format (even if already that format) and re-compressed. - GIF & TIFF Handling: These formats are copied to the output directory without additional compression unless converted to WebP or AVIF, as
sharphas limited specific compression options for them. - Error Handling: The script includes basic error handling for file operations.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by Aayan
