Skip to content

Repository files navigation

cbz-tools-optimizer

High-performance CBZ optimizer built in Rust — batch resize, compress, and convert images (JPEG/PNG/WebP/AVIF/GIF) inside ZIP/CBZ/RAR/CBR archives, fully offline. CLI for Windows / Linux / macOS. Windows GUI included.

License: MIT


Download

Download the latest release from Releases.

Archive Contents
cbz-tools-optimizer-vX.Y.Z-windows-x64.zip cbz-opt.exe (CLI) + cbz-opt-gui.exe (GUI)
cbz-tools-optimizer-vX.Y.Z-linux-x64.tar.gz cbz-opt (CLI)
cbz-tools-optimizer-vX.Y.Z-macos-x64.tar.gz cbz-opt (CLI)

Extract the archive and run cbz-opt.exe or cbz-opt-gui.exe directly. No installation is required. Linux and macOS archives remain CLI-only.


Why cbz-tools-optimizer?

📦 Storage savings Significantly reduce file size — real-world result: 9.0 GB → 647.6 MB (-93%) in 1m 35s
🔄 Format conversion Convert JPEG / PNG / WebP / AVIF in bulk — resize and convert in a single pass
Speed Parallel processing across archives and images via rayon, fast image resizing, and native JPEG/WebP codecs
🖥️ Cross-platform Windows / Linux / macOS — single binary, no install
🎯 Device-ready presets iPad, Kindle, 4K and more — one flag to optimize for your device
🤖 Script-friendly Batch CLI with JSON output for automation and pipeline integration
🖱️ GUI included Windows drag-and-drop GUI — no CLI knowledge required

CLI Usage

Resize

# Basic (default: ipad preset 2048×1536, JPEG quality 85)
cbz-opt input.cbz

# Convert a RAR/CBR book to an optimized CBZ
cbz-opt input.rar

# Multiple files
cbz-opt *.zip

# Kindle preset
cbz-opt --preset kindle --quality 80 --suffix _small *.cbz

# Custom size
cbz-opt --preset custom --max-width 1280 --max-height 720 input.zip

# Specify output directory
cbz-opt --output-dir ./output input.cbz

Format Conversion

# Convert all images to WebP (no resize)
cbz-opt --output-format webp --convert-only input.cbz

# Convert Animated GIF entries to Animated WebP (no resize)
# Animated GIF input is converted to Animated WebP regardless of --output-format
cbz-opt --convert-only input-with-animated-gif.zip

# Convert to AVIF for maximum compression (no resize)
cbz-opt --output-format avif --convert-only *.cbz

# Resize AND convert to WebP in one pass
cbz-opt --preset ipad --output-format webp input.cbz

# Convert PNG to JPEG (no resize)
cbz-opt --output-format jpeg --convert-only input.cbz

--convert-only: skips resizing entirely. Same-format files are passed through without re-encoding — zero quality loss.

Options

Option Default Description
--preset ipad Size preset (see table below)
-W, --max-width Maximum width in pixels (--preset custom only)
-H, --max-height Maximum height in pixels (--preset custom only)
-q, --quality 85 Lossy quality (1–100) — used by JPEG output and resized animated WebP
-s, --suffix _new Output filename suffix
-o, --output-dir (same as input) Output directory
-t, --threads 0 (auto) Number of threads (0 = half of logical CPUs)
--output-format jpeg Output image format: jpeg / png / webp / avif / original
--convert-only Convert format only — skip resize entirely. --preset / -W / -H are ignored. Same-format files are passed through without re-encoding (zero degradation)
--resize-filter catmull-rom Static image resize interpolation: bilinear, catmull-rom, or lanczos3
--animated-webp-filter bilinear Animated WebP resize interpolation: bilinear (fast/smooth), catmull-rom (sharper bicubic), or lanczos3 (highest-detail comparison; slowest)
--animated-webp-keyframes bounded Animated WebP keyframe policy: bounded uses the interval below; disabled does not force periodic keyframes and ignores kmin / kmax
--animated-webp-kmin / --animated-webp-kmax 3 / 5 Minimum / maximum distance between animated-WebP key frames (kmax >= 2, 0 <= kmin < kmax, kmin >= kmax / 2 + 1)
--animated-webp-output-policy always-use-encoded Animated WebP output size policy: write the high-quality resized result (default), or use keep-original-if-larger to retain an oversized source entry instead
--log-mode cli Log output: cli / silent / both / file
--overwrite-mode skip Output conflict resolution: skip / overwrite / rename
--json Output progress as JSON lines (for scripting and automation)

Size Presets

Preset Width Height Intended device
ipad 2048 1536 iPad (default)
ipad-air 2360 1640 iPad Air
ipad-pro 2732 2048 iPad Pro
kindle 1264 1680 Kindle Paperwhite
hd 1280 720 HD display
full-hd 1920 1080 Full HD display
four-k 3840 2160 4K display
custom (manual) (manual) Use -W / -H

Supported Formats

Archives

Input archives Output archive
ZIP ZIP
CBZ CBZ
RAR / CBR CBZ

RAR/CBR input follows the same UnRAR-based handling as the companion viewer. The output is a ZIP container with a .cbz extension.

Images

Format Input Output
JPEG Yes Yes
PNG Yes Yes
WebP (static) Yes Yes
WebP (animated) Yes Re-encoded as animated WebP
AVIF Yes Yes
BMP Yes Converted to output format
TIFF Yes Converted to output format
GIF (static) Yes Yes
GIF (animated) Yes Animated WebP

Static images are resized and re-encoded using the selected output format and quality settings. Static GIFs are decoded through the GIF-specific path and then use the static pipeline; original keeps an in-bounds static GIF byte-identical, while a resized original GIF is written as PNG because GIF encoding is not included. Animated WebP and animated GIF use dedicated paths that preserve frame timing, loop count, and animation; animated GIF input is converted to Animated WebP regardless of --output-format, except that keep-original-if-larger may retain the source GIF and its original entry name. Animated WebP resize and keyframe behavior can be configured with the corresponding --animated-webp-* options. BMP and TIFF inputs are converted to the selected output format. AVIF is supported as both input and output.


GUI Usage

  1. Launch cbz-opt-gui.exe
  2. Drag and drop ZIP/CBZ/RAR/CBR files or folders onto the window (or use Add Files… / Add Folder…)
  3. Configure options via the button and click ▶ Start
  4. A completion summary is shown next to the Start button when processing finishes
Ready Done
GUI file list GUI done

Notes:

  • cbz-opt.exe is not required alongside the GUI — image processing is built in
  • Supports English / 中文 / 日本語 (language selector in the menu bar)
  • Settings are saved automatically to cbz-opt-gui.toml in the same folder

Build from Source

Prerequisites (Windows): Requires the MSVC toolchain (stable-x86_64-pc-windows-msvc).
Install "Desktop development with C++" workload from Visual Studio 2022 (or Build Tools for Visual Studio).
The MSVC linker path is pre-configured in .cargo/config.toml — no Developer Command Prompt is required.

# All crates
cargo build --release

# CLI
cargo build --release -p cbz-tools-optimizer-cli

# GUI (Windows)
cargo build --release -p cbz-tools-optimizer-gui

Contributing

Bug reports and feature requests are welcome via GitHub Issues.
Please use the provided issue templates.


How It Works

Multiple ZIP/CBZ/RAR/CBR files
  └── process archives in parallel
        └── process image entries in parallel
              ├── Static images
              │     └── decode → resize if needed → encode
              │
              ├── Animated WebP
              │     └── animated decode → resize if needed → encode
              │
              └── Animated GIF
                    └── GIF decode → Animated WebP encode
  • Images already within the pixel-dimension limit are not resized, but are still encoded into the selected output format in normal mode. To preserve their bytes, use --convert-only with the matching output format.
  • Animated WebP and Animated GIF are processed through dedicated animation paths that preserve frame timing, loop count, and animation.
  • Animated GIF frames are decoded and encoded sequentially. Animated GIF input is converted to Animated WebP; --convert-only leaves the canvas dimensions unchanged.
  • JPEG DCT pre-scaling is deliberately conservative: the final target dimensions receive a 20% guard, and only 1/4, 1/2, or full decode are considered so the DCT result does not undershoot the guarded target.
  • Each archive is processed independently; one failure does not abort others.
  • Default thread count is half of logical CPUs to avoid saturating the system (override with --threads N).
  • Output file conflict is controlled by --overwrite-mode (default: skip existing files).
  • A log file (cbz-opt_YYYYMMDD_HHMMSS.log) is written when --log-mode both or file is specified.
  • On completion, total file size savings and elapsed time are reported.

Changelog

See CHANGELOG.md.


Third-Party Licenses

See THIRDPARTY_LICENSES.md.


License

MIT — see LICENSE.

About

Bulk-resize images inside ZIP/CBZ archives — significantly reduce file size with parallel processing

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages