How can I easily resize an image after it has been uploaded in Django? I am using Django 1.0.2 and I’ve installed PIL.
I was thinking about overriding the save() method of the Model to resize it, but I don’t really know how to start out and override it.
Can someone point me in the right direction? Thanks 🙂
@Guðmundur H: This won’t work because the django-stdimage package does not work on Windows 🙁
You should use a method to handle the uploaded file, as demonstrated in the Django documentation.
In this method, you could concatenate the chunks in a variable (rather than writing them to disk directly), create a PIL Image from that variable, resize the image and save it to disk.
In PIL, you should look at
Image.fromstringandImage.resize.