Skip to content

CLI Usage EN

zipax-bot edited this page Aug 11, 2026 · 1 revision

CLI Usage

zipax-cli is the command-line entry point for the compression core, useful for testing and automation. It shares the same compression logic (zipax-core) as the desktop app.

Basic Usage

cd zipax-cross
# show help
cargo run -q -p zipax-cli -- --help

Plan

Preview the compression result without writing files:

cargo run -q -p zipax-cli -- plan photo.jpg
cargo run -q -p zipax-cli -- plan photo.png --overwrite --output-format webp

Compress

JPEG

# default quality
cargo run -q -p zipax-cli -- compress photo.jpg --level 4
# convert to AVIF
cargo run -q -p zipax-cli -- compress photo.jpg --output-format avif --level 4
# limit dimensions
cargo run -q -p zipax-cli -- compress photo.jpg --max-width 128 --max-height 128

PNG

cargo run -q -p zipax-cli -- compress photo.png --level 4
# convert to WebP with a 500KB target size
cargo run -q -p zipax-cli -- compress photo.png --output-format webp --target-size-kb 500

Batch (multiple files)

cargo run -q -p zipax-cli -- compress a.png b.png --output-format webp

Common Flags

Flag Description
--level N Quality level 1–6 (default 3)
--output-format <fmt> Output format: jpeg / png / webp / avif
--max-width / --max-height Dimension limits (pixels)
--target-size-kb N Target file size (KB)
--overwrite Overwrite the original file

Tests

cargo test

Back to Home-EN · 中文版:CLI 使用

Clone this wiki locally