imgproxykit¶
A typed Python toolkit for building imgproxy URLs.
Define reusable image transformations, generate signed URLs, and create named variants for thumbnails, avatars, and previews.
Build your first URL¶
Install imgproxykit with Python 3.12 or newer:
uv add imgproxykit
poetry add imgproxykit
pip install imgproxykit
Create a client pointing to your imgproxy server and define a thumbnail transformation:
from imgproxykit import Client, Transform
from imgproxykit.options import Resize
client = Client('https://imgproxy.example.com') # (1)!
source_url = 'https://originals.example.com/photo.jpg' # (2)!
thumbnail = Transform(
Resize.fill(width=300, height=300),
format='webp',
)
thumbnail_url = client.url(source=source_url, transform=thumbnail) # (3)!
print(thumbnail_url)
Public URL of your imgproxy server. Replace it with your own address.
URL of the original image. Replace it with an image URL accessible to your imgproxy server.
Build the URL without making a network request. Imgproxy fetches and processes the source image when the generated URL is requested.
Show Output
https://imgproxy.example.com/unsafe/resize:fill:300:300/format:webp/aHR0cHM6Ly9vcmlnaW5hbHMuZXhhbXBsZS5jb20vcGhvdG8uanBn
Use thumbnail_url in an image’s src attribute or an API response.
Reuse thumbnail with other source images to apply the same transformation.
Tip
URL generation makes no network requests. Your imgproxy server fetches and processes the image when the generated URL is requested. You need a running imgproxy server to serve images.
Find your way¶
Getting started walks through installation and your first image URLs.
User guide introduces the client, transformations, processing options, and named variants.
Django integration configures a shared client and generates URLs from model file fields.
Django Modern REST returns image URLs and variants from typed controllers.
DRF integration returns image URLs and variants from serializer fields.
FastAPI integration registers clients as application dependencies.
API Reference lists classes, arguments, types, and extension points.
Version history tracks releases and compatibility changes.