1

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?

3
  • 2
    This sounds like a job for imagemagic and bash. Commented Nov 20, 2009 at 7:27
  • 1
    "Best" doesn't mean anything. Please replace it with something specific, concrete and tangible. Fastest, cheapest, etc., are measurable. Best is too vague to even debate. Commented Nov 20, 2009 at 11:10
  • Changed from 'best' to 'effective'... Thanks Commented Nov 20, 2009 at 14:28

6 Answers 6

10

It seems, ImageMagick with PerlMagick fits your task nicely.

Sign up to request clarification or add additional context in comments.

1 Comment

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.
9

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

Comments

6

Offhand, Python with the Python Imaging Library.

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

Comments

5

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.

Comments

2

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)

Comments

2

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.