Skip to main content

imgproxykit

A typed Python toolkit for building imgproxy URLs.

Tests Result PyPI Version PyPI Downloads Supported Python Version License

Build imgproxy URLs with typed Python options and reusable transformations. Define image settings once, compose them for different use cases, and generate named variants from a single source.

Features

  • Fully typed and checked with mypy, pyright, ty and pyrefly in strict modes
  • Signed URLs using your imgproxy server's key and salt
  • Immutable, reusable transforms combining typed options and scalar arguments
  • Variants: generate multiple image URLs from a reusable set of transforms
  • Support for named presets configured on your imgproxy server
  • Django, Django Modern REST, Django REST Framework, FastAPI, Litestar integration

Installation

Requires Python 3.12+. A running imgproxy server is needed to serve images from the generated URLs.

pip install imgproxykit

There are several included extras:

  • 'imgproxykit[django]' provides Django integration with shortcuts, template tags, and client configuration through Django settings
  • 'imgproxykit[drf]' provides Django REST Framework integration with serializer fields for image URLs and named variants
  • 'imgproxykit[fastapi]' provides FastAPI integration with a dependency for injecting the client into route handlers
  • 'imgproxykit[litestar]' provides Litestar integration with a plugin that injects the client into route handlers

Examples

Generate a thumbnail URL

Build a URL for a cropped webp thumbnail:

>>> from imgproxykit import Client, Transform
>>> from imgproxykit.options import Resize

>>> # Public URL of your imgproxy server.
>>> client = Client('https://imgproxy.example.com')

>>> thumbnail = Transform(
...     Resize.fill(width=300, height=300),  # Pass typed option objects.
...     quality=80,  # Or scalar keywords, equivalent to Quality(80).
...     format='webp',
... )

>>> source_url = 'https://originals.example.com/products/backpack.jpg'
>>> thumbnail_url = client.url(source=source_url, transform=thumbnail)

The generated URL has this structure, with the source URL encoded as URL-safe base64:

https://imgproxy.example.com/unsafe/resize:fill:300:300/quality:80/format:webp/<encoded-source>

thumbnail_url points to a cropped webp thumbnail.

Generate image variants

Build variants by extending a shared transform with a width for each size:

>>> from imgproxykit import Client, Transform

>>> client = Client('https://imgproxy.example.com')

>>> # Share quality and output format across all variants.
>>> base = Transform(quality=85, format='webp')
>>> products = {
...     'small': base.extend(width=320),
...     'medium': base.extend(width=640),
...     'large': base.extend(width=1280),
... }

>>> source_url = 'https://originals.example.com/products/backpack.jpg'
>>> # Build one URL per variant for the same source image.
>>> product_urls = client.variants(source=source_url, variants=products)
>>> small_url = product_urls['small']  # Access a URL by its variant name.

product_urls maps each variant name to its generated URL (shown here with the encoded source abbreviated):

{
    'small': 'https://imgproxy.example.com/unsafe/quality:85/format:webp/width:320/<encoded-source>',
    'medium': 'https://imgproxy.example.com/unsafe/quality:85/format:webp/width:640/<encoded-source>',
    'large': 'https://imgproxy.example.com/unsafe/quality:85/format:webp/width:1280/<encoded-source>',
}

Next steps

  • Read the documentation for client configuration, transformations, variants, and processing options.
  • Check the changelog for new features, fixes, and breaking changes.
  • Find published releases on PyPI.

Contributing

See the contributing guide for development setup and checks. Bug reports and feature requests are welcome on the issue tracker.

License

MIT

Credits

Generated with wemake-python-package (template version).

Metadata

Release files for imgproxykit 0.6.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 imgproxykit 0.6.0
File Size Uploaded Provenance Actions
imgproxykit-0.6.0.tar.gz 35.2 kB With provenance Details for imgproxykit-0.6.0.tar.gz

Built distribution (wheel)

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

Total release size: 98.4 kB

Release files / imgproxykit-0.6.0.tar.gz

Download URL imgproxykit-0.6.0.tar.gz
Size 35.2 kB
Tags Source
SHA-256 checksum
How to use checksums
655738b801b9b61d76b9c66cc19462062c81a839c32ca73e3cb8f972a909e819
BLAKE2b-256 checksum
How to use checksums
891336c40bb2aa6d95fe7c79ace56b4b64ffa98caa1474a14d6347755d199d92
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 Nov 6, 2026.

Transparency log

Release files / imgproxykit-0.6.0-py3-none-any.whl

Download URL imgproxykit-0.6.0-py3-none-any.whl
Size 63.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
442c6991d13aa706ea16477df50e9598768d8c037ab6afcbed543d8c7d553ce7
BLAKE2b-256 checksum
How to use checksums
90ff0eac196dd69dd1dd38a38ecb0068a446dbd1c96d573b844d7da9ead00dd4
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 Nov 6, 2026.

Transparency log

Security for imgproxykit 0.6.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 imgproxykit-0.6.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 Nov 6, 2026.

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.

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