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.
- Comics
- Manga
- Scans of Book Pages
- 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.
- Books Scanned by Chapters: Organize and combine folders of scanned book chapters into a CBZ for easy reading.
- Manga Collections: Turn folders of manga scans into CBZ files while maintaining series structure and metadata.
- Large Document Collections: Quickly convert and organize image-based archives into CBZ files for easy distribution or self-hosting.
- Metadata Addition: Add or fix missing series metadata for existing CBZ files.
- The script takes a main directory as input.
- It walks through the directory structure to find subdirectories containing images.
- 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.
- The generated CBZ files are saved in a
CBZ_Filesfolder within the main directory.
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.
- Clone or download this repository.
- Install Python (if not already installed).
- Copy the script to your desired directory.
- Update the
main_directoryvariable with the path to your main directory. Example:main_directory = r"C:\Users\user\Documents\Mangas\MANGA" - Run the script:
python cbz_creator.py
- Python 3.6 or later.
- Ensure your directory structure is organized with images in subfolders.
os zipfile pathlib shutil xml.etree.ElementTree
- 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.
- 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.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
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!
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!