Skip to main content

A command-line tool to pad and resize images

Project description

Publish Python Package

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:

  1. Clone the repository:

    git clone https://github.com/yourusername/image-padder.git
    cd image-padder
    
  2. Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows use venv\Scripts\activate
    
  3. Install development dependencies:

    pip install -r requirements.txt
    
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

image_padder-0.1.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

image_padder-0.1.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file image_padder-0.1.1.tar.gz.

File metadata

  • Download URL: image_padder-0.1.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for image_padder-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8a805761c8dd981f0a67aea8c6e1b83cbe05eff804c5415ffd8cf551c800b0de
MD5 9d1f129ad2ae263def631d8647c2c3b4
BLAKE2b-256 4e54e5993636d1f0369d7cdfb52e86d01505a944ee34ce728e22a1e6411ece67

See more details on using hashes here.

File details

Details for the file image_padder-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: image_padder-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for image_padder-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 840f1f55e5a46e063b0543c802e00504b82ce58d6d8291acb6aaf15b3c2cbf07
MD5 af48695553a708d4daff5cf18c16ec9f
BLAKE2b-256 31fea752661433ecb1c1233b5b6c59c85f09dae40aea93347d7bb881baf2ee04

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page