views:

285

answers:

6

I need to make a script to read images from a directory, rename them, resize them to a MAX_HEIGHT, MAX_WIDTH, put a watermark logo and save them in JPG.

I was thinking on doing this with an interpreted language, like Ruby, PHP, Perl, Python, or any with the image manipulation capabilities.

Which language would you recommend for this?

+10  A: 

It seems, ImageMagick with PerlMagick fits your task nicely.

elder_george
I wouldn't suggest to use Perl Magick. I had a problem with it that the imagemagick part segfaulted on some bad images - and since perlmagick loads imagemagick as library - it effectively ended my program.
depesz
+6  A: 

Offhand, Python with the Python Imaging Library.

More answers here: What is the best image manipulation library?

Jason Orendorff
thanks for the link, that really helps
davidrobles
+9  A: 

Any language + ImageMagick set of programs. Using them via libraries (like PerlMagick) proved to be less than optimal, but doing it via system() calls worked incredibly well. You can find a set of scripts that:

  • perform several useful tasks
  • show less known features of ImageMagick
depesz
+1 for the set of scripts
sebthebert
+2  A: 

You could look at what "phatch" does (http://photobatch.stani.be/), that's a python image batch pocessor.

It tries to use all the various open source image manipulation libraries (imagemagick, python's PIL, exiftools, etc) for the parts where they are good in. So even if you (probably) end up not using phatch itself, you can get a good idea of which tools are good for what. (See summary of a talk by phatch's author)

Reinout van Rees
+4  A: 

In the past, I've found the Imager Perl module to be hugely useful. It has a better API than GD and ImageMagick (IMHO) and is very fast. It also doesn't necessarily require external libraries such as libgd or ImageMagick except potentially the system library for reading/writing your desired file format.

I'm not going to try to answer the "which language is best" part of your question because I'm biased and that's the wrong question to ask anyway. It should be "How can I do X with any of these languages" and then decide for yourself based on the language specific answers. Judging from answers that pit one language against another is not advised. Usually, the bias and agenda of the person providing the answer isn't clear and thus the value of the answer for deciding is nil.

tsee
+2  A: 

Yet another alternative: shell of your choice, using netpbm.

ysth