Memory usage in django-imagekit is unacceptable -- ideas on fixes?

394 Views Asked by At

Django-imagekit, which I'm using to process user uploaded images on a social media website, uses an unacceptably high level of memory. I'm looking for ideas on how to get around this problem.

We are using django-imagekit to copy user uploaded images it into three predefined sizes, and saves the four copies (3 processed plus 1 original) into our AmazonS3 bucket.

This operation is quickly causing us to go over our memory limit on our Heroku dynos. On the django-imagekit github page, I've seen a few suggestions for hacking the library to use less memory.

I see three options:

  1. Try to hack django-imagekit, and deal with the ensuing update problems from using a modified third party library
  2. Use a different imaging processing library
  3. Do something different entirely -- resize the images on in the browser perhaps? Or use a third party service? Or...?

I'm looking for advice on which of these routes to take. In particular, if you are familiar with django-imagekit, or if you know of / are using a different image processing library in a Django app, I'd love to hear your thoughts.

Thanks a lot!

Clay

1

There are 1 best solutions below

0
On BEST ANSWER

Try to change image size with PIL from console and see if memory usage is ok. Image resize is a simple task, I don't believe you should use side applications. Besides, split your task into 3 tasks(3 images?).