Python script for efficiently resizing images within CBZ files with customizable compression settings, featuring added read-only support for CBR files
CBZ Resizer is a Python script developed to resize images within CBZ files. Users can specify a compression percentage to reduce image sizes, thus affecting the overall size of the CBZ file. It also offers read-only support for CBR files due to the rarfile library's limitation, which is a read-only library. Given this limitation and the script's primary focus on CBZ files, the project name remains "CBZ Resizer". For CBR files, the script can decompress the RAR archive, resize the images as required, and repack them into a new CBZ file.
- Resizes images within a CBZ file
- Read-only support for CBR files: decompresses CBR, resizes images, and converts to CBZ
- Customizable compression percentage
- Automatic output with "_resize" suffix
- Python 3.x
- PIL (Python Imaging Library), installable via
pip install Pillow
- rarfile, installable via
pip install rarfile
(needed for CBR support)
To set up the development environment:
-
Clone the repository:
git clone https://github.com/levysoft/CBZResizer
-
Enter the project directory:
cd CBZResizer
-
Create a Python virtual environment:
python3 -m venv venv
-
Activate the virtual environment:
- On Windows:
.\venv\Scripts\activate
- On Unix or MacOS:
source venv/bin/activate
- On Windows:
-
Install dependencies:
pip install -r requirements.txt
To use the script, run the command:
python3 cbz_resizer.py input_file [compression_percentage]
Where input_file is the CBZ or CBR file to be processed and compression_percentage is an optional value indicating the compression level (0-100, default 50%).
If you need sample CBZ or CBR files to test the CBZ Resizer script, you can download pre-built files from the following link: https://github.com/clach04/sample_reading_media/releases/. These files can be useful for testing the resizing and conversion functionalities of the script without the need to use large files
Contributions are always welcome! Please follow these steps to contribute to the project:
- Fork the repository.
- Create a new branch:
git checkout -b branch_name
. - Make your changes and commit:
git commit -am 'Add some changes'
. - Push to the branch:
git push origin branch_name
. - Create a pull request.
This script was created for educational purposes and is not guaranteed for production use.
This project was created by Antonio Troise.
Special thanks to clach04 for providing sample CBZ and CBR files, which are available for download at clach04/sample_reading_media/releases. These sample files are incredibly helpful for anyone looking to test the functionalities of CBZ Resizer.
Antonio Troise
This project is released under the MIT License. See the LICENSE file for more details.