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