opposable-thumbs
Make thumbnails and simple image edits from Python, or serve them from your
web app with URLs like
/thumb?file=media/photo.jpg&p=fit,300,300&format=webp.
It is designed to plug into a project you already have: install it, add a few lines, and your app serves its own thumbnails, with no separate image server, reverse proxy or other infrastructure to run. Sources must be allowed explicitly, URLs are signed, and every request is limited in size and work, so it is safe to expose to the public.
It isn't trying to compete with dedicated image servers such as Thumbor or imgproxy. They are faster and do more, e.g. face-aware cropping, cloud storage and animated images. If you serve a lot of images, or speed matters most, use one of those instead.
Requires Python 3.11+. Uses Pillow for images and requests to fetch remote ones.
Install
pip install opposable-thumbs
For the Django or Flask integration, install opposable-thumbs[django] or
opposable-thumbs[flask] instead, which also requires the framework.
Quick start
Django
# settings.py
INSTALLED_APPS = [..., "opposable_thumbs.django"]
OPPOSABLE_THUMBS = {"roots": {"media": MEDIA_ROOT}}
# urls.py
urlpatterns = [..., path("thumb/", include("opposable_thumbs.django.urls"))]
{% load opposable_thumbs %}
<img src="{% thumbnail_url "media/photo.jpg" "fit,300,300|unsharp" format="webp" %}">
More in Using with Django.
Flask
from opposable_thumbs.flask import init_app
app.config["OPPOSABLE_THUMBS"] = {"roots": {"media": "/srv/media"}}
init_app(app)
<img src="{{ thumbnail_url('media/photo.jpg', operations='fit,300,300|unsharp') }}">
More in Using with Flask.
Python
from opposable_thumbs import Config, make_thumbnail
config = Config(roots={"media": "/srv/media"})
thumbnail = make_thumbnail(
config, file="media/photo.jpg", operations="fit,300,300", format="webp"
)
thumbnail.data # the image, as bytes
More in The Python API, and for other web frameworks, see Using with another web framework.
Features
- 29 operations, including
fit,pad,cropratio,rotate,circle,rounded,unsharpand colour adjustments, with JPEG, PNG, WebP, GIF, BMP and TIFF output. - Signed URLs, so nobody can make up their own.
- Sources from named folders or allowed URLs only, with limits on download size, image size and work per request.
- Optional caches for downloaded sources and finished thumbnails, plus
ETag,Cache-Controland304 Not Modifiedfor browsers and CDNs. - Faster, lower-memory decoding of large JPEGs, and EXIF orientation applied so phone photos come out upright.
Documentation
- Using with Django
- Using with Flask
- Using with another web framework
- The Python API: functions, results and errors
- Operations and output: every operation, query parameters, output formats, speed
- Configuration: settings, allowed sources, signed URLs, limits
- Caching: the caches, cleaning them, and browser and CDN caching
The repository also has a playground for trying every operation in a browser, and a guide to working on the project: see DEVELOP.md.
Licence
BSD 3-Clause. See LICENCE.
Metadata
Release files for opposable-thumbs 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 | Provenance | |
|---|---|---|---|---|
| opposable_thumbs-0.1.0.tar.gz | 56.7 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opposable_thumbs-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 88.1 kB
Release files / opposable_thumbs-0.1.0.tar.gz
| Download URL | opposable_thumbs-0.1.0.tar.gz |
|---|---|
| Size | 56.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
378732ba4abe8eb4444f0db13d7b1b9c1e7b6779a1377fa1d6491c1f4b07b4e9
|
|
BLAKE2b-256 checksum How to use checksums |
635bdf066fb029f4b83c35874cb2f6192f3efee18e9f1af4641ad1aa26b0f404
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 24, 2026.
Transparency logRelease files / opposable_thumbs-0.1.0-py3-none-any.whl
| Download URL | opposable_thumbs-0.1.0-py3-none-any.whl |
|---|---|
| Size | 31.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e686ec00604d3b3b0248baf7c6a18db6bde0a324fcccb66bebc1eb3b49103a93
|
|
BLAKE2b-256 checksum How to use checksums |
9ab95937be5b91194c46b0d2b823cd251da2c0014bdecbdb6929467f473a3104
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 24, 2026.
Transparency logSecurity for opposable-thumbs 0.1.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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for opposable_thumbs-0.1.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 Oct 24, 2026.
Transparency logA 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.