resizebento-image
Image resizing, cropping, padding, and format conversion for Python, built with Pillow.
Built by ResizeBento.com, a collection of privacy-friendly image tools.
Install
pip install resizebento-image
Resize a file
from resizebento_image import resize_image
result = resize_image(
"input.jpg",
"output.webp",
width=800,
height=600,
mode="crop-to-fit",
quality=80,
)
print(result.width, result.height)
When an output path is supplied and output_format is omitted, the output format is inferred from .jpg, .jpeg, .png, or .webp.
Work with bytes
from resizebento_image import resize_image
with open("input.png", "rb") as file:
source = file.read()
result = resize_image(
source,
width=1200,
height=630,
mode="add-padding",
output_format="jpg",
padding_color="#ffffff",
quality=90,
)
with open("result.jpg", "wb") as file:
file.write(result.data)
bytes, bytearray, BytesIO, file-like binary objects, str paths, and pathlib.Path are supported as inputs.
Resize by percentage
from resizebento_image import resize_image_by_percentage
result = resize_image_by_percentage(
"input.png",
50,
"output.png",
)
Read dimensions
from resizebento_image import get_image_dimensions
dimensions = get_image_dimensions("input.webp")
print(dimensions.width, dimensions.height)
Resize modes
| Mode | Behavior |
|---|---|
crop-to-fit |
Center-crops to completely fill the target size. |
stretch |
Stretches directly to the target size. |
add-padding |
Fits the complete image inside the target and fills the remaining area with a background color. |
fill-frame |
Uses the same centered cover behavior as ResizeBento's Fill Frame mode. |
Formats and defaults
Input formats: JPEG, PNG, WebP.
Output formats: JPG, PNG, WebP.
Without a destination path or explicit output_format, the default output is WebP. JPG and WebP support quality from 10 to 100, with 80 as the default. PNG ignores quality.
Target dimensions range from 1 to 16,384 pixels per side, with a maximum output area of 64,000,000 pixels. Percentage resizing supports 1% to 500%.
Result
Every resize returns a ResizeResult:
result.data # encoded image bytes
result.width
result.height
result.format # "webp", "jpg", or "png"
result.mime_type
result.filename
result.output_path
Errors
Validation and processing failures raise ImageResizerError with a machine-readable code.
from resizebento_image import ImageResizerError, resize_image
try:
resize_image("input.jpg", width=0, height=600)
except ImageResizerError as error:
print(error.code)
Privacy
The package processes images locally in your Python process. It does not upload image content to ResizeBento.
For interactive browser tools, visit ResizeBento.com.
License
MIT
Metadata
Release files for resizebento-image 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| resizebento_image-1.0.1.tar.gz | 10.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| resizebento_image-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.4 kB
Release files / resizebento_image-1.0.1.tar.gz
| Download URL | resizebento_image-1.0.1.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b687b5239c57b91d51280937e8a2c09e32d0c3ee04bb3041864943a7621ab82b
|
|
BLAKE2b-256 checksum How to use checksums |
61186c783f134215f049011ea34388f8d1de669c8550e291a44403116caee7a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / resizebento_image-1.0.1-py3-none-any.whl
| Download URL | resizebento_image-1.0.1-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4f95b00fe425c8d090d94016b1bd0c0d4b542a2d3c76bca81686c2e095191af4
|
|
BLAKE2b-256 checksum How to use checksums |
77b750ccb316447cee7212938e159fb04a575d828f076ff849c7c66285706aac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Security for resizebento-image 1.0.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.