Skip to main content

Willow image library

PyPI PyPI downloads Build Status

A wrapper that combines the functionality of multiple Python image libraries into one API.

Documentation

Overview

Willow is a simple image library that combines the APIs of Pillow, Wand and OpenCV. It converts the image between the libraries when necessary.

Willow currently has basic resize and crop operations, face and feature detection and animated GIF support. New operations and library integrations can also be easily implemented.

The library is written in pure Python and supports versions 3.9, 3.10, 3.11, 3.12, and 3.13.

Examples

Resizing an image

from willow.image import Image

f = open('test.png', 'rb')
img = Image.open(f)

# Resize the image to 100x100 pixels
img = img.resize((100, 100))

# Save it
with open('test_thumbnail.png', 'wb') as out:
   img.save_as_png(out)

This will open the image file with Pillow or Wand (if Pillow is unavailable).

It will then resize it to 100x100 pixels and save it back out as a PNG file.

Detecting faces

from willow.image import Image

f = open('photo.png', 'rb')
img = Image.open(f)

# Find faces
faces = img.detect_faces()

Like above, the image file will be loaded with either Pillow or Wand.

As neither Pillow nor Wand support detecting faces, Willow would automatically convert the image to OpenCV and use that to perform the detection.

Available operations

Documentation

Operation Pillow Wand OpenCV
get_size() ✓ ✓ ✓
get_frame_count() ✓** ✓ ✓**
resize(size) ✓ ✓
crop(rect) ✓ ✓
rotate(angle) ✓ ✓
set_background_color_rgb(color) ✓ ✓
transform_colorspace_to_srgb(rendering_intent) ✓
auto_orient() ✓ ✓
save_as_jpeg(file, quality) ✓ ✓
save_as_png(file) ✓ ✓
save_as_gif(file) ✓ ✓
save_as_webp(file, quality) ✓ ✓
save_as_heic(file, quality, lossless) ✓⁺
save_as_avif(file, quality, lossless) ✓⁺ ✓⁺
save_as_ico(file) ✓ ✓
has_alpha() ✓ ✓ ✓*
has_animation() ✓* ✓ ✓*
get_pillow_image() ✓
get_wand_image() ✓
detect_features() ✓
detect_faces(cascade_filename) ✓

* Always returns False

** Always returns 1

⁺ Requires the pillow-heif library

Metadata

Release files for Willow 1.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Willow 1.10.0
File Size Uploaded Provenance Actions
willow-1.10.0.tar.gz 113.7 kB With provenance Details for willow-1.10.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for Willow 1.10.0
File Interpreter ABI Platform Actions
willow-1.10.0-py3-none-any.whl Python 3 none any Details for willow-1.10.0-py3-none-any.whl

Total release size: 233.0 kB

Release files / willow-1.10.0.tar.gz

Download URL willow-1.10.0.tar.gz
Size 113.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e10673ff954e79ca0412c648e40dd9ce0b93c8bef798e8468ce3411ff972fb15
BLAKE2b-256 checksum
How to use checksums
8d739bc0a72cfaf0f280e9aeea61eae8760723b8c353c0656041dda4c6dc2833
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Apr 22, 2025.

Transparency log

Release files / willow-1.10.0-py3-none-any.whl

Download URL willow-1.10.0-py3-none-any.whl
Size 119.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
26861dbacc9584f5d4566de7d31c092437225abc4b1978fa9ac44a433200f938
BLAKE2b-256 checksum
How to use checksums
34a1d380e90da1306d53fff9d1cac17d80acb7aca9679a2cb4f0f8459239c1bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Apr 22, 2025.

Transparency log

Security for Willow 1.10.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for willow-1.10.0.tar.gz

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 Apr 22, 2025.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.10.0 This release

2 release files Full provenance

0.3b2

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page