Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

CBZ Maker

CBZ Maker is a Python-based tool for building CBZ files out of images in sequence. It simplifies the process of organizing, combining, and adding metadata to large collections of documents, manga, or scanned books to ensure they are maintained in the correct series for self-hosted reading platforms like Kavita.

Works Good On

  • Comics
  • Manga
  • Scans of Book Pages

Features

  • Batch CBZ Creation: Automatically converts folders of images into properly formatted CBZ files.
  • Metadata Embedding: Adds series metadata (ComicInfo.xml) to ensure files are grouped and labeled correctly.
  • Supports Existing CBZ Files: Scans for existing CBZ files in the series and updates them with missing metadata.
  • Self-Hosted Platform Compatibility: Designed to work seamlessly with self-hosted platforms like Kavita.
  • Supports common image file formats: .jpg, .jpeg, and .png.

Use Cases

  1. Books Scanned by Chapters: Organize and combine folders of scanned book chapters into a CBZ for easy reading.
  2. Manga Collections: Turn folders of manga scans into CBZ files while maintaining series structure and metadata.
  3. Large Document Collections: Quickly convert and organize image-based archives into CBZ files for easy distribution or self-hosting.
  4. Metadata Addition: Add or fix missing series metadata for existing CBZ files.

How It Works

  1. The script takes a main directory as input.
  2. It walks through the directory structure to find subdirectories containing images.
  3. For each subdirectory:
    • It sorts the image files by name.
    • Creates a CBZ file named after the folder.
    • Adds the images to the CBZ file.
  4. The generated CBZ files are saved in a CBZ_Files folder within the main directory.

Example

Given the following directory structure: Main_Directory/ ├── Series1/ │ ├── page1.jpg │ ├── page2.jpg │ └── page3.jpg ├── Series2/ │ ├── cover.png │ ├── page1.png │ └── page2.png └── CBZ_Files/ (generated by the script)

After running the script, the CBZ_Files folder will contain: CBZ_Files/ ├── Series1.cbz └── Series2.cbz

Each CBZ file will include the respective images from the original subdirectories.

How to Use

  1. Clone or download this repository.
  2. Install Python (if not already installed).
  3. Copy the script to your desired directory.
  4. Update the main_directory variable with the path to your main directory. Example: main_directory = r"C:\Users\user\Documents\Mangas\MANGA"
  5. Run the script: python cbz_creator.py

Prerequisites

  • Python 3.6 or later.
  • Ensure your directory structure is organized with images in subfolders.

Requirements

os zipfile pathlib shutil xml.etree.ElementTree

Notes

  • Only .jpg, .jpeg, and .png images are included in the CBZ files.
  • The script skips folders without images.
  • The CBZ_Files directory is automatically created in the main directory if it doesn't already exist.

Error Handling

  • If the specified main directory is not valid, the script will print an error message and terminate.
  • Folders without images are skipped, and a message is displayed.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributions

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

Acknowledgments

Inspired by the need to maintain well-organized manga and comic collections for self-hosted platforms. Shoutout to the community of self-hosting enthusiasts for their support and feedback!

Contact

For questions or feedback, open an issue or reach out to the repository maintainer.

Let me know if you'd like any changes or additions!

About

Python script automates the process of converting folders of image files into CBZ (Comic Book Zip) files

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages