A command-line tool to pad and resize images
Project description
Image Padder
Image Padder is a command-line tool for batch processing image files. It can pad images to a specified aspect ratio, resize them, and supports custom background colors.
Features
- Supports jpg, jpeg, png, webp, and avif image formats
- Pads images to a specified aspect ratio (default 1:1)
- Customizable padding background color (default black)
- Optional image resizing
- Batch processing of entire folders
- Processed images saved in a new folder with original filenames
Installation
Install Image Padder using pip:
pip install image-padder
Usage
Basic usage:
image-padder <input_folder> [options]
Options:
--ratio: Target aspect ratio (width/height). Default is 1.0 (square).--bg-color: Background color in hex format (e.g., #FFFFFF). Default is #000000 (black).--output-size: Output size after processing, specified as WIDTH HEIGHT.
Example:
image-padder /path/to/image/folder --ratio 1.5 --bg-color "#FFFFFF" --output-size 800 600
This command processes all supported images in /path/to/image/folder, padding them to a 3:2 aspect ratio with a white background, and resizing to 800x600 pixels.
Output
Processed images are saved in a new folder at the same level as the input folder. The new folder is named:
{original_folder_name}_padded_{random_three_letters}
For example, if the input folder is "my_images", the output folder might be "my_images_padded_xyz".
Development
To set up the development environment:
-
Clone the repository:
git clone https://github.com/yourusername/image-padder.git cd image-padder -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use venv\Scripts\activate -
Install development dependencies:
pip install -r requirements.txt -
Install the package in editable mode:
pip install -e .
Contributing
We welcome issue reports and pull requests. For major changes, please open an issue first to discuss what you'd like to change.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file image_padder-0.1.0.tar.gz.
File metadata
- Download URL: image_padder-0.1.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f3bb10447025f546eff76bc71b22f4acb749fb8bb0d5568149216728737028f
|
|
| MD5 |
13324063b7c95ac889a21b69d8c8f347
|
|
| BLAKE2b-256 |
b163ce84dcf9cc65992093cde96c126f69a3179626267bd0c0d04108c197ebb8
|
File details
Details for the file image_padder-0.1.0-py3-none-any.whl.
File metadata
- Download URL: image_padder-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9dca9bcc2388f9120f4f73d20d0b7c8c684c05c008fa6098fe74b3bd2d77ad7
|
|
| MD5 |
b36bcbda4a92d0a03f34b8916c4d596a
|
|
| BLAKE2b-256 |
5538879afc174f05f8dce20c27e2208d0e30331a4cbbbbd38dd04570e073b456
|