Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resizing images on the server

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!

like image 375
Chris Dutrow Avatar asked Aug 02 '12 20:08

Chris Dutrow


People also ask

What is a resizing image?

Resizing allows you to make your image smaller or larger without cutting anything out. Resizing alters the image's dimensions, which typically affects the file size and image quality. The most common reason for resizing photos is to reduce the size of large files to make them easier to email or share online.

Which tool is used for resizing an image?

BeFunky is a great free image resize tool that offers a lot of options. You can resize your image by width or height or by percentage scale.

What is image resizing in deep learning?

Resizing images is a critical pre-processing step in computer vision. Principally, deep learning models train faster on small images. A larger input image requires the neural network to learn from four times as many pixels, and this increase the training time for the architecture.


3 Answers

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

like image 188
dm03514 Avatar answered Oct 14 '22 01:10

dm03514


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

like image 40
Rakesh Avatar answered Oct 14 '22 00:10

Rakesh


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.

like image 1
mattexx Avatar answered Oct 14 '22 01:10

mattexx