Question

Background: I have to upload images from users.

Problem: The images need to be re-sized so that I don't end up with huge images on my disk. This re-sizing should happen just after the image is saved.

I have checked the following code

Django Snippet for image scaling

But couldn't use it directly, as the windows path of the image was giving a issue. Is there a simple way in which the scaling can be done. Are there any python or django modules which can directly be used for this ? If yes which will be the most optimized one ?

Was it helpful?

Solution

Make use of the Python PIL library. With this library you can manipulate images and make the changes you require. There are loads of examples of using PIL over the net.

I would recommend you using the PIL library and writing your own code as it can be a lot easier than trying to get third party libraries working (personal experience).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top