Skip to content

Compression Engine EN

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

Compression Engine

The compression engine lives in zipax-cross/crates/zipax-core and is the heart of the project, shared by the desktop app and the CLI.

Supported Formats

Format Encoder Notes
JPEG mozjpeg High-quality JPEG compression
PNG oxipng + imagequant Lossless optimization + palette quantization
WebP webp crate Lossy / lossless
AVIF ravif (RAV1E) Next-gen high-efficiency format
HEIC libheif-rs Read HEIC and transcode (embedded libheif)
TIFF image crate Read support
GIF image crate Read support
PDF Ghostscript (external process) Compress PDFs, see Ghostscript-Install-EN

Note: HEIC requires the libde265 system library; deb/rpm packages declare the libde265-0 / libde265 dependency.

Compression Modes (CompressionMode)

Mode key Default level Notes
Quality first quality L1 Prioritize visual quality
Balanced balanced L3 Balance quality and size (default)
Size first size L6 Prioritize small size
Advanced advanced L3 Manual quality control
Target size target / target_size L3 Compress to a target size (e.g. 500KB)

Quality Levels (QualityLevel)

6 levels (L1 highest → L6 lowest), mapped to 0.0–1.0 quality floats:

Level Quality
L1 0.95
L2 0.88
L3 0.80
L4 0.70
L5 0.60
L6 0.50

Compression Planning (plan)

plan_compression produces a CompressionPlan before execution:

  • Estimates output size and savings
  • Iteratively approaches the target KB in target-size mode
  • Frontend shows "estimated savings" based on the plan
  • Detects previously-compressed markers to skip files

Workflow Options

  • Overwrite original: write directly to the original path
  • Skip compressed files: recognize prior compression markers
  • Copy after compression: output to a directory and keep the original
  • Preserve metadata: keep EXIF and other metadata where possible
  • Resize limits: max-width / max-height constrain the output size

Batch Processing

process.rs supports compressing multiple files at once (desktop compress_batch, CLI multi-file args). Combined with notify, folder automation adds newly added files to the queue automatically.

Back to Home-EN · 中文版:压缩引擎

Clone this wiki locally