Skip to main content

CBZFit

Fit manga and comic archives to your screen.

CBZFit resizes images in CBZ archives for a target display resolution while preserving their aspect ratio and original image format. Images that already fit are copied without re-encoding. CBZFit preserves non-image members, and leaves the source archive unchanged by default.

Features

  • Resize portrait pages and landscape spreads for a target display
  • Preserve JPEG, PNG, and WebP image formats
  • Copy images without re-encoding when resizing is unnecessary
  • Preserve archive member order and non-image members such as ComicInfo.xml
  • Derive a safe destination name when DESTINATION is omitted
  • Verify generated archives before publication
  • Publish output atomically to avoid incomplete destination archives
  • Display interactive transformation and verification progress
  • Report image counts, elapsed time, and archive-size change

Requirements

  • Python 3.12 or later

Installation

Recommended: pipx

Install CBZFit from PyPI with pipx:

pipx install cbzfit

Upgrade an existing installation with:

pipx upgrade cbzfit

Usage

cbzfit SOURCE [DESTINATION] --screen-width PIXELS --screen-height PIXELS

Screen dimensions must be positive and supplied in portrait orientation, with the width no greater than the height.

For example, resize an archive to a 1404 x 1872 display:

cbzfit "Manga Volume 01.cbz" --screen-width 1404 --screen-height 1872

When DESTINATION is omitted, the final extension of SOURCE must be .cbz or .zip. CBZFit inserts [CBZFit] before that extension and writes the output beside the source. The above example creates:

Manga Volume 01 [CBZFit].cbz

Specify the destination

For a source with another extension or no extension, provide DESTINATION explicitly.

cbzfit zipped-images.data comic-resized.cbz --screen-width 1404 --screen-height 1872

Landscape pages

By default, landscape images are fitted to the display in landscape orientation. To use portrait display bounds for every image:

cbzfit manga.cbz --screen-width 1404 --screen-height 1872 --no-landscape-display

Upscaling

Images smaller than the target display are not enlarged by default. Enable upscaling with:

cbzfit comic.cbz --screen-width 1404 --screen-height 1872 --upscale

Existing destinations

The default conflict mode is error, which stops without modifying the source or destination. Use --conflict replace to replace an existing destination or process an archive in place:

cbzfit manga.cbz manga.cbz --screen-width 1404 --screen-height 1872 --conflict replace

Output verification

Select verification with --verify MODE:

  • structure, the default, reopens the generated archive and validates its ZIP structure
  • crc reads every output member and validates its compressed data and CRC
  • none trusts successful ZIP finalization and skips reopening the output

For the strongest verification:

cbzfit comic.cbz --screen-width 1404 --screen-height 1872 --verify crc

Progress

Progress is shown automatically when standard error is an interactive terminal. Transformation and CRC verification display member-based progress bars. Progress is written to standard error so the final summary remains on standard output.

Progress is suppressed when standard error is redirected. Disable it explicitly with:

cbzfit manga.cbz --screen-width 1404 --screen-height 1872 --no-progress

Completion summary

Successful processing prints a three-line summary:

Output: optimized.cbz completed in 10.5 s
└─Images: 200 total, 100 transformed, 100 unchanged. Other members copied: 100
└─Size: 180.0 MiB -> 95.8 MiB, 46.8 % decrease

Run the built-in help for the complete command reference:

cbzfit --help

Supported files and behavior

CBZFit processes ZIP-based archives containing static JPEG, PNG, or WebP images.

  • Resized images preserve their source image format.
  • Images that already fit are copied without re-encoding.
  • Non-image members, including ComicInfo.xml, are preserved in archive order but are not interpreted or edited.
  • The source archive remains unchanged unless in-place replacement is explicitly requested.
  • Generated output is finalized, optionally verified, and published atomically.

CBZFit rejects:

  • archives without supported images
  • invalid ZIP archives
  • animated images
  • encrypted archive members
  • unsafe or duplicate member paths
  • unsupported ZIP compression methods
  • image content that does not match its filename extension
  • archive members or archives that exceed the configured safety limits

Development

Clone the repository and create a virtual environment:

git clone https://github.com/luigibrosse/cbzfit.git
cd cbzfit
python -m venv .venv

Activate it:

# Windows PowerShell
.venv\Scripts\Activate.ps1

# Linux or macOS
source .venv/bin/activate

Install CBZFit in editable mode with the development dependencies:

python -m pip install -e ".[dev]"

Run Ruff and the complete test suite with branch coverage:

python -m ruff check .
python -m pytest --cov=cbzfit --cov-branch --cov-report=term-missing --cov-fail-under=100

Build and validate the distributions:

python -m pip install --upgrade build twine
python -m build
python -m twine check --strict dist/*

Versioning

CBZFit follows Semantic Versioning. Version 0.1.0 is an initial pre-1.0 release. Before 1.0, minor releases may introduce documented CLI or behavior changes. Patch releases are intended for backward-compatible fixes and documentation or packaging corrections.

User-visible changes are recorded in CHANGELOG.md. src/cbzfit/__init__.py is the authoritative version source through cbzfit.__version__; Hatchling derives the package metadata version from it.

License

CBZFit is licensed under the GNU General Public License v3.0 or later.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cbzfit-0.1.0.tar.gz (71.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cbzfit-0.1.0-py3-none-any.whl (35.4 kB view details)

Uploaded Python 3

File details

Details for the file cbzfit-0.1.0.tar.gz.

File metadata

  • Download URL: cbzfit-0.1.0.tar.gz
  • Upload date:
  • Size: 71.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cbzfit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e45ddb0bf6abb30483fb58d7302cc6e80562ddcccc5e523555f3d1865532abf1
MD5 d01c5a53a3f7f2bcda1ff5d94d563ff3
BLAKE2b-256 18750b5024da93304a28c8017f2af77c07e0682672b4a5d5ffec47343057df8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for cbzfit-0.1.0.tar.gz:

Publisher: release.yml on luigibrosse/cbzfit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cbzfit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cbzfit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 35.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cbzfit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d19b28c348c359fb432c120f5c8714a18ede3bf83f61ad4c35a69fc7a2c0a4d7
MD5 e1ef973f8ede2659eca7c6ec86e2bc6d
BLAKE2b-256 08b2af35ff3372080d01842235a72a78efa412ec88585a3a9bdcc1815de98566

See more details on using hashes here.

Provenance

The following attestation bundles were made for cbzfit-0.1.0-py3-none-any.whl:

Publisher: release.yml on luigibrosse/cbzfit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page