image_optimizer/
lib.rs

1//! # Image Optimizer
2//!
3//! A high-performance CLI tool for optimizing images written in Rust.
4//!
5//! This crate provides image optimization capabilities for JPEG, PNG, WebP, and SVG formats
6//! with support for parallel processing, quality control, resizing, and backup creation.
7//!
8//! ## Features
9//!
10//! - **Multi-format support**: JPEG (mozjpeg), PNG (oxipng with zopfli), WebP, SVG (regex-based)
11//! - **Parallel processing**: Concurrent optimization using rayon
12//! - **Flexible output**: In-place optimization or separate output directory
13//! - **Quality control**: Adjustable quality settings and lossless mode (raster formats only)
14//! - **Image resizing**: Optional resizing with `--max-size` parameter (raster formats only)
15//! - **Backup support**: Create backup files before optimization
16//! - **Progress tracking**: Real-time progress bar with file-by-file status
17//! - **Self-updating**: Built-in update mechanism via GitHub releases
18//!
19//! ## Architecture
20//!
21//! The crate is organized into distinct modules following a one-function-per-file pattern:
22//!
23//! - [`cli`] - Command-line interface components
24//! - [`file_ops`] - File system operations and utilities
25//! - [`optimization`] - Image optimization functionality
26//! - [`updater`] - Self-update functionality
27//!
28//! ## Usage
29//!
30//! ```bash
31//! # Optimize all images in a directory recursively
32//! image-optimizer -i ./images -r
33//!
34//! # Optimize with custom quality and backup
35//! image-optimizer -i input_dir -o output_dir --quality 90 --backup
36//!
37//! # Resize and optimize with lossless compression
38//! image-optimizer -i images --max-size 1024 --lossless
39//! ```
40
41pub mod cli;
42pub mod file_ops;
43pub mod optimization;
44pub mod updater;