$ pip install django-photoprocessor
(or clone the source and put the photoprocessor module on your path)
Add ImageWithProcessorField to your models.
# myapp/models.py from django.db import models from photoprocessor.fields import ImageWithProcessorsField thumbnails = {'thumbnail':{'resize':{'width':100, 'height':100, 'crop':'center'}, 'quality':90}, 'display': {'resize':{'width':500, 'height':500, 'crop':'center'}, 'quality':90}} class Photo(models.Model): name = models.CharField(max_length=100) original_image = ImageWithProcessorsField(upload_to='books', thumbnails=thumbnails)
Access your thumbnails
photo = Photo(name='myphoto') photo.original_image.save('myfile.jpg', myfileobj) print photo.original_image['thumbnail'].url