Skip to main content

CBZ is a Python package designed to facilitate the creation, manipulation, and extraction of comic book archive files in the CBZ format.

Project description

CBZ

License Release Latest Version

CBZ is a Python package designed to facilitate the creation, manipulation, and extraction of comic book archive files in the CBZ format. It allows users to programmatically generate CBZ files from a collection of images, add metadata to the archives, and unpack existing CBZ files. This library is ideal for comic book enthusiasts, archivists, and developers working on applications involving digital comic book distributions.

Features

  • Create CBZ Files: Pack a series of images into a CBZ file with ease.
  • Extract CBZ Files: Unpack images and metadata from existing CBZ files.
  • Manage Metadata: Add, update, and retrieve metadata from CBZ files, including titles, authors, volume numbers, and more.
  • Support for ComicInfo.xml: Utilizes the ComicInfo.xml standard for embedding comic book metadata within CBZ files.
  • Flexible Image Handling: Load images from various formats and ensure they are correctly formatted and ordered within the CBZ file.
  • High-Level API: Offers a simple, high-level API for common tasks, while also providing access to lower-level functions for advanced usage.

Installation

To install the CBZ library, you can use pip:

pip install cbz

Quick Start

Here's a quick example of how to create a CBZ file from a series of images:

from pathlib import Path
from cbz.page import PageInfo
from cbz.comic import ComicInfo
from cbz.constants import PageType, YesNo, Manga, AgeRating, Format

if __name__ == '__main__':
    # Define the path to your images
    images_path = Path('path/to/your/images')

    # Load images and create page objects
    pages = [PageInfo.load(path) for path in images_path.iterdir()]

    # Create a ComicInfo object with your comic's metadata
    comic = ComicInfo.from_pages(
        pages=pages,
        title='Your Comic Title',
        series='Your Comic Series',
        number='1',
        language_iso='en',
        format=Format.WEB_COMIC,
        black_white=YesNo.NO,
        manga=Manga.NO,
        age_rating=AgeRating.PENDING
    )

    # Pack the comic into a CBZ file
    cbz_content = comic.pack()

    # Save the CBZ file
    cbz_path = Path('your_comic.cbz')
    cbz_path.write_bytes(cbz_content)

Documentation

For detailed documentation, including the full API reference and more examples, please refer to the official CBZ Library documentation.

License

The CBZ Library is released under the MIT License. See LICENSE for details.

Acknowledgments

This library was developed with the needs of comic book fans and digital archivists in mind. We hope it helps you in managing and enjoying your comic book collections.

Project details


Download files

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

Source Distribution

cbz-3.2.0.tar.gz (18.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page