A Django app that generates derived images from uploads using specs, processors, and template tags. Thumbnails, crops, and custom pipelines run without hand-rolling Pillow code.
Overview
Django ImageKit is a Django application for processing images. When an application needs thumbnails, resized avatars, or other variants of user-uploaded files, ImageKit builds those derivatives from declarative image specs instead of ad hoc scripts.
Processing is defined through image specs: instructions that take a source image and produce a new file. ImageSpecField attaches specs to model fields so derivatives behave like ImageFields but are generated on demand and cached. ProcessedImageField applies processors at upload time and stores only the result. Specs can also live in standalone classes for use in views or anywhere a file-like source is available.
Built-in processors cover common tasks such as resize and crop via the processors module, and custom processors implement a simple process method on PIL images. Specs chain multiple processors in order and set output format and quality. Template tags generate images in HTML, including registered generators and a shorthand thumbnail tag. Form fields mirror model ProcessedImageField for upload flows that keep processing out of models.
Install Pillow, add the imagekit app to installed apps, and define specs on models or in templates. Generated cache paths are constructed from the source and spec so ImageSpecFields need no extra database columns.
Key features
- ImageSpecField for on-demand derived images
- ProcessedImageField for upload-time processing
- Built-in resize and crop processors
- Custom processor classes
- Template tags for inline generation
- Registered image generator IDs
- Form field variant for uploads
- PILKit-backed processor library
Use cases
- User avatar thumbnails
- Resized gallery images
- View-specific image transforms
- Upload forms with automatic processing