# CLI Options imgx provides a powerful command-line interface (CLI) for performing image operations. This page documents all available commands and their options. ## Global Options These options apply to all imgx commands: ```text --help, -h Show help information --version, -v Show version information --verbose Enable verbose output --config Path to config file (default: imgx.config.{ts,js}) ``` ## Commands ### `optimize` Optimizes one or more images to reduce file size while maintaining quality. ``` imgx optimize [options] ``` **Arguments:** - `input`: File path or glob pattern for images to optimize **Options:** - `--output, -o `: Output file or directory - `--quality, -q `: Quality setting (1-100) (default: 80) - `--format, -f `: Output format (jpeg, png, webp, avif) - `--progressive, -p`: Enable progressive mode - `--no-progressive`: Disable progressive mode - `--preserve-metadata`: Preserve image metadata - `--overwrite`: Overwrite existing files (default: true) **Examples:** ```bash # Optimize a single image imgx optimize image.jpg # Optimize and convert to WebP imgx optimize image.jpg -f webp # Optimize multiple images with glob imgx optimize "images/**/*.{jpg,png}" -q 85 # Specify output directory imgx optimize image.jpg -o optimized/ ``` ### `convert` Converts images from one format to another. ``` imgx convert --format [options] ``` **Arguments:** - `input`: File path or glob pattern for images to convert **Options:** - `--format, -f `: Output format (required) - `--output, -o `: Output file or directory - `--quality, -q `: Quality setting (1-100) (default: 80) - `--lossless`: Use lossless compression (for WebP/AVIF) - `--progressive, -p`: Enable progressive mode - `--preserve-metadata`: Preserve image metadata **Examples:** ```bash # Convert to WebP imgx convert image.jpg -f webp # Convert to AVIF with custom quality imgx convert image.jpg -f avif -q 70 # Convert multiple images imgx convert "images/*.jpg" -f webp -o converted/ ``` ### `responsive` Generates responsive image sets in multiple sizes. ``` imgx responsive [options] ``` **Arguments:** - `input`: Image file path **Options:** - `--sizes `: Comma-separated list of widths (default: 320,640,960,1280,1920) - `--formats, -f `: Comma-separated list of formats (default: webp,jpeg) - `--quality, -q `: Quality setting (1-100) (default: 80) - `--output-dir, -o `: Output directory - `--filename-template