Batch image processing in OS X (for free)

I know, I know ... this is not my usual type of story. Anyway, I will try to come up with more of this.
One week ago one friend needed a tool to rescale few thousands photos scattered in tens of folders. Unfortunately the images were in jpeg format and using a simple Photoshop/Automate/Batch was not possible (it asked about the compression quality at every save).
Most of the known batch processors were of commercial kind and given the ideea of being as cheap as posible I had to find a solution.
The best til now is to use Phatch (thanks Stani for this great tool).
The only issue I have with Phatch is that the instalation is not as straight forward as you would expect. For that reason I tried to compil a short How to for Phatch instalation procedure.
First thing first download everything you will need:
  • wxPython
  • Pil (Python Imaging Library)
  • zlib library
  • IJG jpeg library
  • ... and most probably the latest Xcode development package from Apple
Fortunately you can use the default Python that came installed with OS X. If you use OS X 10.5 you will have Python 2.5 and that perfect for the job.

wxPython has a nice installer for OS X so you will not face any issues with it.
Right after it you have to install Xcode (if you din not used it before). Unfortunately that's a large package (over 900Mb). You can find it here: http://developer.apple.com/technology/xcode.html
(I'm talking about the Mac only version). This also has a nice installer so I will not get into details.
Next you have to unpack the IJG jpeg library downloaded from here: http://www.ijg.org/. After unpacking open terminal, navigate to the folder where the content of the archive is and type:
sudo ./configure
sudo make
sudo make test

of course you have to press Enter after each line :D
If that doesn't complain, do
sudo make install

Now let's do the same for Zlib. Go to http://www.zlib.net/zlib-1.2.3.tar.gz , download the file and unpack it.
Go to the folder in terminal an type again:
sudo ./configure
sudo make test
sudo make install

The last step is to instal Pil itself. That is in fact tham main brick in the wall.
You can download the package from here: http://www.pythonware.com/products/pil/
Got to the folder in terminal and type:
python setup.py build_ext -i
python selftest.py
If the report shows that you have support for the libraries you need yo can go to the last step of the instalation and type"
sudo python setup.py install

Now in order to run Phatch you have to open a terminal, go to the folder where you've made a copy of the Phatch subfolder from the original archive and type: python phatch.py

Most probably that will not work and you will face an error.
The solution is to go in Terminal / Preferences menu and there in Advanced tab uncheck "Set LANG environment variable on startup". Close the teminal window, open it again, go to Phatch folder and type: python phatch.py

That was all.
Now you can do a lot of processing on you images just making some drag and drops from here to there.
Enjoy your Phatch :)

No comments: