Image Multisize Resizer
A robust, production-ready Python Command Line Interface (CLI) tool that allows you to resize a single image into multiple widths in one go. It uses Python's built-in argparse library for the CLI and the Pillow library for high-quality image processing.
The tool automatically calculates proportional heights based on your target widths, ensuring the original aspect ratio is perfectly maintained using high-quality LANCZOS resampling.
👥 For Users
Features
- Multiple Sizes at Once: Provide a comma-separated list of widths to generate multiple images simultaneously.
- Aspect Ratio Preservation: Automatically scales the height proportionally to the provided width.
- High-Quality Resampling: Uses
Image.Resampling.LANCZOSfor the best possible resized image quality. - Custom Output Directory: Save the generated images in the same directory as the original, or specify a custom output path.
- Descriptive Naming: Automatically appends the generated width to the filename (e.g.,
photo_800px.jpg).
Installation
You can install the package directly via pip:
pip install image-multisize-resizer
(Note: If installing from source, clone the repository and run pip install .)
Usage
Once installed, the multi-resizer command is available globally.
Arguments:
-i,--image(Required): Path to the input image file.-s,--sizes(Required): Comma-separated list of target widths (e.g.,300,600,1200).-o,--output(Optional): Directory to save resized images. Defaults to the input image directory.
Examples:
1. Basic Usage Saves copies directly next to your original file.
multi-resizer -i photo.jpg -s 400,800,1200
Output files generated: photo_400px.jpg, photo_800px.jpg, and photo_1200px.jpg.
2. Custom Output Directory Saves copies into a dedicated folder (the tool will create the directory if it doesn't exist).
multi-resizer --image elements.png --sizes 150,300 --output ./thumbnails
Output files generated: ./thumbnails/elements_150px.png and ./thumbnails/elements_300px.png.
Error Handling
- Gracefully handles missing input files.
- Creates the target output directory if it does not already exist.
- Validates the target sizes argument to ensure it contains a valid list of integers.
💻 For Developers
Local Setup
To set up the project locally for development:
- Clone the repository:
git clone https://github.com/ishandutta2007/image-multisize-resizer.git cd image-multisize-resizer
- Create and activate a virtual environment (recommended):
python -m venv venv # On Windows use: venv\Scripts\activate # On Linux/macOS use: source venv/bin/activate
- Install the package in editable mode along with dependencies:
pip install -e .
Requirements
- Python 3.7+
- Pillow >= 9.5.0
Contributing
Please refer to the CONTRIBUTING.md file for more details on how to contribute to this project. We welcome bug reports, feature requests, and pull requests.
📦 For Package Publishers
The publishing process for this package to PyPI is fully automated using GitHub Actions and PyPI Trusted Publishing (OIDC).
How Automated Publishing Works
Whenever a new git tag starting with v (e.g., v0.1.1) is pushed to the repository, the GitHub Actions workflow (.github/workflows/publish.yml) is triggered.
The workflow will:
- Checkout the repository.
- Set up Python.
- Build the source distribution (
sdist) and wheel (bdist_wheel) using thebuildmodule. - Publish the package securely to PyPI using the
pypa/gh-action-pypi-publishaction via an OIDC token. Theskip-existing: trueflag ensures that if the version already exists, the step will simply skip publishing without failing.
How to Release a New Version
To publish a new version of the package to PyPI, follow these steps:
- Open
pyproject.toml. - Update the
version = "X.Y.Z"field to the new desired version. - Commit your changes.
- Create a new git tag matching the version (with a
vprefix) and push it to origin:git tag vX.Y.Z git push origin vX.Y.Z
- The GitHub Action will trigger on the pushed tag and automatically build and publish the new version to PyPI.
Initial Setup (For Project Owner)
If this is your first time setting up the repository for PyPI publishing via OIDC:
- Go to your project on PyPI (or create the project if it doesn't exist).
- Navigate to Manage > Publishing.
- Add a new GitHub publisher.
- Provide the GitHub repository owner (
ishandutta2007), repository name (image-multisize-resizer), and workflow filename (publish.yml). - This grants the GitHub Action permission to publish to PyPI securely without needing to store API tokens as secrets.
Release files for image-multisize-resizer 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| image_multisize_resizer-0.1.0.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| image_multisize_resizer-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.0 kB
Release files / image_multisize_resizer-0.1.0.tar.gz
| Download URL | image_multisize_resizer-0.1.0.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
93de35f134b83c5bced549b222a8b29d656cdf12c5397d2fcf594b63d62130be
|
|
BLAKE2b-256 checksum How to use checksums |
f107f61d0aba3c26328968203327bac73cede0216ac5f0234464755ee52cbe79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 16, 2026.
Transparency logRelease files / image_multisize_resizer-0.1.0-py3-none-any.whl
| Download URL | image_multisize_resizer-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
26b92851c5201fb0c9102d617ce97886c9840ecec2e63c14e0404eee18e5e1b9
|
|
BLAKE2b-256 checksum How to use checksums |
09beed4e235a0e6c46636a878b011fa213311c2d954c13c3d2deaa6c22e23b7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 16, 2026.
Transparency log