English 中文(简体)
Effective Interpreted Programming Language for File/Image manipulation
原标题:

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?

最佳回答

It seems, ImageMagick with PerlMagick fits your task nicely.

问题回答

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

Offhand, Python with the Python Imaging Library.

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

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.

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)

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





相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签