5

We just implemented a feature where our users can upload photos. We are re-sizing what the user has uploaded into thumbnail and an 800x600 "display" size.

The problem we are having is that this operation seems to be taking up a lot of memory on our server. We are using Django-imagekit to do this and there seems to be documented problems with excessive memory usage.

We are running django on a Heroku server. In case this factors in, we are using postgresql for data and elasticsearch for search as well.

  • Is there a better library that we should be using for this?
  • Or is there a completely different strategy for handling user photos on the server that we should consider?

Thanks so much!

Chris Dutrow
  • 48,402
  • 65
  • 188
  • 258
  • Is there any reason why this needs to be handled within Django at all? (Do you need to be able to serve the resized photos immediately?) If not, breaking free from Django would allow you to use any other folder-watching, automated tool you prefer. – Dave Aug 02 '12 at 20:34
  • @Mr. Dave - No, I don't think it needs to be. I think these are just the tools that we grabbed first. Just not sure what the next one we should try is :) – Chris Dutrow Aug 02 '12 at 20:57

3 Answers3

2

I don't know what django-imagekit offers but you could just use PIL and when saving an upload image resize it to the sizes that you need.

http://effbot.org/imagingbook/image.htm

Jonathan Root
  • 535
  • 2
  • 14
  • 31
dm03514
  • 54,664
  • 18
  • 108
  • 145
2

I have used and it works well PythonMagick and you could also try wand it is a ctypes-based ImagedMagick binding library for Python

Rakesh
  • 81,458
  • 17
  • 76
  • 113
1

I have used gd2 with ruby, which works pretty well. It's written in C, so it is fast and shouldn't take a whole lot of memory. It looks like there are Python bindings.

mattexx
  • 6,456
  • 3
  • 36
  • 47