PEBIRT is a free and open source lightweight python console app designed to simplify bulk image cropping and resizing. It is a ridiculously tiny script thanks to using Pillow's image processing, inspired by rembg's bulk background removal. Combine them to speed up uniform image uploads.
In the spirit of automating the boring things with python, this tool automates cropping images to a square 1:1 ratio and resizing them by default to 800x800, my preferred image size for e-shop product images. It is ideal for e-commerce data entry enthusiasts with beginner python experience.
- Bulk processing: Resize and crop multiple images at once without manual intervention
- Customizable output size: Default is 800x800, but you can modify dimensions as needed
- Lightweight and fast: A minimalistic Python script with no unnecessary complexity
- PNG file support: Works by default with .png files, but can be extended to other formats
- Simple setup: Just drop images in the folder and run the script - no complex configurations needed
- Clone or download the repository to your local machine
- Place your images in the project folder
- Open a terminal and cd into the project folder
- Make sure Python is installed by running
python -V
- Install requirements by running
pip install -r requirements.txt
- Run
python resize.py
Default behaviour only works with .png files. You can choose the filetype by adjusting the path.glob pattern in resize.py
Default cropping behaviour:
- Detect whether the image is wider or taller
- Center the crop to 1:1 square ratio
- Resolution agnostic
You can choose a different ratio by adjusting the crop function - don't forget to change the pixel width and height in the resize function to match your new ratio
Default resizing behaviour:
- Resize image to 800x800 using the Lanczos algorithm
You can choose a different size by adjusting the pixel width and height in the resize function
Contributions are welcome! If you have ideas to improve the process or find any issues feel free to submit a pull request or open an issue describing the problem.
Happy resizing!