1
0
Fork
You've already forked cbztools-rust
0
comics utility, written in rust
  • Rust 95.2%
  • Roff 4.8%
2026年03月31日 10:52:47 +02:00
src release: v0.2.0 — update README and bump version 2026年03月31日 10:52:47 +02:00
.gitignore merged .gitignore 2025年07月07日 00:28:34 +02:00
Cargo.lock release: v0.2.0 — update README and bump version 2026年03月31日 10:52:47 +02:00
Cargo.toml release: v0.2.0 — update README and bump version 2026年03月31日 10:52:47 +02:00
cbr2cbz.1 feat: rewrite cbr2cbz in Rust with minimal dependencies and clear CLI 2025年07月07日 00:27:49 +02:00
LICENSE Initial commit 2025年07月07日 00:26:47 +02:00
README.md release: v0.2.0 — update README and bump version 2026年03月31日 10:52:47 +02:00
TODO.md release: v0.2.0 — update README and bump version 2026年03月31日 10:52:47 +02:00

cbztools-rust

A fast, feature-rich comic archive utility written in Rust. Converts CBR/RAR, CBZ, PDF and plain image folders into well-formed CBZ archives with optional image processing.

Features

  • CBR → CBZ conversion — extract RAR archives and repack as ZIP/CBZ
  • CBZ re-zip (--zip-force) — repack existing CBZ files (useful with --deflate)
  • PDF → CBZ (--pdf) — rasterise PDF pages to images and pack as CBZ
  • Image folder → CBZ (--images) — pack a directory of images directly
  • DEFLATE compression (--deflate, --deflate-level) — lossless ZIP compression for smaller files
  • Image shrinking (--shrink) — re-encode large pages as JPEG with configurable quality, height cap and optional grayscale conversion
  • Strip extras (--strip-extras) — remove non-image sidecar files (NFO, TXT, XML, DB, ...) from output
  • Regex filtering (--match, --exclude, --match-page, --exclude-page) — include/exclude archives or individual pages by pattern
  • Parallel processing (--jobs) — rayon-backed thread pool; 0 = number of logical CPUs
  • Overwrite control (--overwrite) — skip existing outputs by default, re-process when set
  • Flat output (--flat) — write all outputs into the destination root without mirroring subdirectory structure
  • What-if mode (--what-if) — dry-run with no file system changes
  • Size summary — reports total bytes in/out and percentage reduction after a batch run

Installation

cargo install --path .

Requires a system unrar binary on $PATH for CBR extraction.

Usage

cbr2cbz <SOURCE> <DEST> [OPTIONS]

SOURCE can be a single archive/PDF/folder or a directory tree (processed recursively).

Options

Flag Short Description
--copy -c Copy non-CBR files to destination unchanged
--no-convert Copy CBR/CBZ instead of converting (implies --copy)
--zip-force -z Re-zip existing CBZ archives
--keep-broken Attempt to convert corrupt archives
--shrink Re-encode large pages as JPEG
--shrink-gray Also convert to grayscale when shrinking
--shrink-kb <KB> Process pages larger than KB (default: 300)
--shrink-qual <Q> JPEG quality 1–100 (default: 40)
--shrink-height <H> Maximum pixel height (default: 1500)
--deflate -d Compress CBZ entries with DEFLATE
--deflate-level <L> DEFLATE level 1–9 (requires --deflate)
--strip-extras -s Remove non-image files from output CBZ
--flat -f Do not mirror source subdirectory structure
--match <REGEX> -m Only process archives matching pattern
--exclude <REGEX> -e Skip archives matching pattern
--match-page <REGEX> Only include pages matching pattern
--exclude-page <REGEX> Exclude pages matching pattern
--case-sensitive Case-sensitive regex matching
--overwrite -o Overwrite existing output files
--jobs <N> -j Parallel jobs (0 = CPU count, default: 1)
--pdf Convert PDF files to CBZ
--pdf-dpi <DPI> DPI for PDF rasterisation (default: 150)
--images Pack image folders as CBZ
--temp-dir <DIR> Use DIR for temporary extraction
--what-if -w Dry-run; no files written
--verbose -v Increase verbosity (repeat for more)

Examples

# Convert all CBRs in a directory tree
cbr2cbz ~/Comics/Marvel ~/Comics/CBZ
# Re-zip and apply DEFLATE compression with 8 threads
cbr2cbz ~/Comics ~/Comics/compressed --zip-force --deflate --deflate-level 6 -j 8
# Shrink pages, strip metadata, grayscale
cbr2cbz source/ dest/ --shrink --shrink-gray --shrink-kb 200 --strip-extras
# Convert PDFs, 4 parallel jobs, dry-run first
cbr2cbz ~/scans ~/cbz --pdf --jobs 4 --what-if

Version

v0.2.0