ANN: Phatch = PHoto bATCH processor and renamer based on PIL

  • Thread starter SPE - Stani's Python Editor
  • Start date
M

Mike Driscoll

You need to compile two things:
1. the exiv2 library
2. the python-pyexiv2 bindings

For the exiv2 library, you will have to dive into the project:
The Windows executable provided here was compiled with the MinGW cross
compiler on an Intel 32 bit machine running Debian.

Maybe the exiv2 Yahoo! group is the right place to be. If you look
there for Windows threads maybe some might be helpful:http://uk.groups.yahoo.com/group/exiv2/message/956

The author of python-pyexiv2 is active there as well and explains his
project uses Scons:http://uk.groups.yahoo.com/group/exiv2/message/1002

I am not an expert on compiling extensions. In fact I only know
Python. A windows version of exiv2 and python-pyexiv2 will only exist
if some Windows programer(s) take the initiative.


I have Visual Studio 6 and .NET 2003 so I think I'm good for that.
Unfortunately, I am not the best at compiling. Hopefully the links you
provided will have plenty of friendly pros who don't mind sharing
their wisdom.

In case you can't compile, it wouldn't be so hard to write a wrapper
around the provided windows executable to mimic the API of python-
pyexiv2.


If it does turn out that they can't help me compile, would you know
how to do this? Are we talking about SWIG here? I've never written a
wrapper.

I am afraid I can't help you more.

Stani

Thanks again,

Mike
 
D

Daniel Fetchinson

I'm pleased to announce the release of Phatch which is a
powerful batch processor and renamer. Phatch exposes a big part of the
Python Imaging Library through an user friendly GUI. (It is using
python-pyexiv2 to offer more extensive EXIF and IPTC support.) Phatch
is not targeted at manipulating individual pictures (such as with
Gimp), but repeating the same actions on hundreds or thousands of
images.

If you know PIL and have some nice recipes laying around, it is very
easy to write plugins as Phatch generates the corresponding GUI
automagically just like in Django. Any existings PIL scripts can be
added very easily. Let me know if you want to contribute or have any
questions.

Homepage: http://photobatch.stani.be (free download link below)
Tutorials: http://photobatch.wikidot.com/tutorials
Translations: https://translations.launchpad.net/phatch/trunk/+pots/phatch
License: GPLv3
Screenshot:
http://photobatch.wikidot.com/local--files/start/Screenshot-Phatch3d.jpg
(the perspective and reflection is produced by Phatch itself)

Phatch has many features, like:
- EXIF information inspector with thumbnail
- limit jpeg file size when saving
- tons of actions organized by tags (including perspective, round
corners, shadow, reflection, ...)
- console version (Phatch can now run without a gui on servers)
- batch rename and copy files based on exif metadata
- data stamping (http://photobatch.wikidot.com)
- online documentation wiki (http://photobatch.wikidot.com)

Linux only features:
- desktop or panel droplets on which images or folders can be dropped
(will be ported to Windows & Mac)
- Nautilus and desktop integration (with its own mime type and
nautilus extension)
- manpage with examples

With python-pyexiv2 the following featues are added:
- embedding the original EXIF and IPTC tags in the image

All actions mostly have a separate pil function in their source code,
so they could be read as a recipe book for PIL:
* Auto Contrast - Maximize image contrast
* Background - Put colour under transparent image
* Border - Crop or add border to all sides
* Brightness - Adjust brightness from black to white
* Canvas - Crop the image or enlarge canvas without resizing the image
* Colorize - Colorize grayscale image
* Common - Copies the most common pixel value
* Contrast - Adjust from grey to black & white
* Convert Mode - Convert the color mode of an image (grayscale, RGB,
RGBA or CMYK)
* Copy - Copy image file
* Effect - Blur, Sharpen, Emboss, Smooth, ...
* Equalize - Equalize the image histogram
* Fit - Downsize and crop image with fixed ratio
* Grayscale - Fade all colours to gray
* Invert - Invert the colors of the image (negative)
* Maximum - Copies the maximum pixel value
* Mask - Apply a transparency mask
* Median - Copies the median pixel value
* Minimum - Copies the minimum pixel value
* Offset - Offset by distance and wrap around
* Posterize - Reduce the number of bits of colour channel
* Perspective - Shear 2d or 3d
* Rank - Copies the rank'th pixel value
* Reflect - Drops a reflection
* Rename - Rename image file
* Rotate - Rotate with random angle
* Round - Round or crossed corners with variable radius and corners
* Saturation - Adjust saturation from grayscale to high
* Save - Save an image with variable compression in different types
* Scale - Scale an image with different resample filters.
* Shadow - Drop a blurred shadow under a photo with variable position,
blur and color
* Solarize - Invert all pixel values above threshold
* Text - Write text at a given position
* Transpose - Flip or rotate an image by 90 degrees
* Watermark - Apply a watermark image with variable placement (offset,
scaling, tiling) and opacity

I develop Phatch on Ubuntu/Linux, but I have tested and polished it
regularly on Windows and Mac Os X. (Only the droplet functionality
needs to be ported.) Phatch is submitted to Debian unstable and
Ubuntu Hardy. Packagers for other platforms are welcome.

Requirements:
- PIL 1.1.5 or higher
- wxPython 2.6 or higher
- pyexiv2 (optional)
- python nautilus bindings (optional)


Now that we are at image manipulation does anyone know of a good,
possibly python based, image manipulation tool that can do the same as
the windows tool andrea mosaic?

http://www.andreaplanet.com/andreamosaic/samples/

Stani, if this is a good place for feature requests I would like to add it :)

Cheers,
Daniel
 
S

SPE - Stani's Python Editor

I have Visual Studio 6 and .NET 2003 so I think I'm good for that.
I am not sure you even need it. I found here some more instructions
for another project which uses libexiv2, which seems to be quite
straightforward:
http://albumshaper.wiki.sourceforge.net/Compiling+on+Windows

I hope some Windows users could try this out.
Unfortunately, I am not the best at compiling. Hopefully the links you
provided will have plenty of friendly pros who don't mind sharing
their wisdom.

Did you have any success so far? Keep me updated. It would be nice to
have EXIF and IPTC support for python on Windows.
If it does turn out that they can't help me compile, would you know
how to do this? Are we talking about SWIG here? I've never written a
wrapper.
No I mean to do some subprocess calls. With exiv2 you extract the exif
information to a temporary *.exv file. This exv file contains all
metadata (inclusive type information), which should be easy to parse
in python. For example to execute the command "exiv2.exe -e -a", you
probably need to do (untested code):
from subprocess import call
call(['exiv2','-e','a',filename],shell=True)
#parse the exiv2 *.exv file

If you are able to parse the exv file, mimicking the python-pyexiv2
library api means putting all the tags in a dictionary. Later you need
to write back your dictionary to an *.exv file and inject it with
"exiv -i" into another image file.

This should you get started, here all command line options of exiv2
are defined:
http://linux.die.net/man/1/exiv2

At the moment Phatch only needs to be able copy the exif tags from one
image file to another, but this will change in the future as Phatch
will allow modifying custom exif data, rotating based on exif & iptc
data and do time shifting. The current functionality is available as
the function copy_metadata at core/lib/_pyexiv2.py

There is also another tool to handle exiftags, called exiftool, which
is Perl based. I prefer exiv2 as it is much faster:
http://picurl.net/development/wiki/Exiv2vsExifTool

I hope this gives enough pointers for people to bring EXIF & IPTC
support to Python and Phatch.

Good luck,
Stani
 
M

Mike Driscoll

Hi,

I am not sure you even need it. I found here some more instructions
for another project which uses libexiv2, which seems to be quite
straightforward:http://albumshaper.wiki.sourceforge.net/Compiling+on+Windows

I hope some Windows users could try this out.


I will look into this and see if I can figure it out.

Did you have any success so far? Keep me updated. It would be nice to
have EXIF and IPTC support for python on Windows.


I posted to the list over the weekend and haven't heard anything. I
don't think there's a ton of users monitoring it like there is on
comp.lang.py.
If it does turn out that they can't help me compile, would you know
how to do this? Are we talking about SWIG here? I've never written a
wrapper.

No I mean to do some subprocess calls. With exiv2 you extract the exif
information to a temporary *.exv file. This exv file contains all
metadata (inclusive type information), which should be easy to parse
in python. For example to execute the command "exiv2.exe -e -a", you
probably need to do (untested code):
from subprocess import call
call(['exiv2','-e','a',filename],shell=True)
#parse the exiv2 *.exv file

If you are able to parse the exv file, mimicking the python-pyexiv2
library api means putting all the tags in a dictionary. Later you need
to write back your dictionary to an *.exv file and inject it with
"exiv -i" into another image file.

This should you get started, here all command line options of exiv2
are defined:http://linux.die.net/man/1/exiv2

At the moment Phatch only needs to be able copy the exif tags from one
image file to another, but this will change in the future as Phatch
will allow modifying custom exif data, rotating based on exif & iptc
data and do time shifting. The current functionality is available as
the function copy_metadata at core/lib/_pyexiv2.py

There is also another tool to handle exiftags, called exiftool, which
is Perl based. I prefer exiv2 as it is much faster:http://picurl.net/development/wiki/Exiv2vsExifTool

I hope this gives enough pointers for people to bring EXIF & IPTC
support to Python and Phatch.

Good luck,
Stani

I'll keep you posted,

Mike
 
S

SPE - Stani's Python Editor

I have been working the last couple of days purely on bug fixing and
to port the code of Phatch fully to Windows as there were many issues.
This has improved:
- Phatch can now create droplets on Windows (win32 extensions
required)
- Installed fonts are retrieved from the Windows registry
- Image file dialogs are now working correctly
- Missing icons are added (including a phatch.ico) and are now
displayed in the windows titlebars
- Image Inspector was missing a panel
- Preview in Image Inspector now displays correctly
- (...)

Besides that Phatch now features for all platforms:
- fonts can be defined with a nice dropdown autocomplete list
- drop down lists with convenient values in all actions
- the action masks now ships with some predefined masks (such as torn
edges)
- right click in the actions dialog box to see the source of an action
- View>Droplet nows shows the name of the action box rendered in the
logo
- Dutch translation is 100% complete

As such no new features have been added, but the user experience feels
much more polished now.

Please read *carefully* the installation instructions first:
http://photobatch.wikidot.com/install#toc6

People who have been using Phatch before should clear their font cache
(if it exists). Simply delete the file:
C:\Documents and Settings\Username\.phatch\fonts

I did the Phatch port on a Windows 2000 machine, so I am curious to
hear how Phatch works on Windows XP and Vista. I will fix any bug (as
far as possible) which is reported quickly in the next couple of days.

You can help translating Phatch here:
https://translations.launchpad.net/phatch/trunk/+pots/phatch

Thanks in advance,

Stani
 
S

Steve Holden

Stani:

You'll be happy to hear that it appears (after a quick test) to work on
Vista, though I blush to admit I actually have a Python running on that
platform.

The font selection is much better than in previous versions - although
the names aren't quite the full font names it's pretty easy to tell
which one will be used.

regards
Steve
 
S

SPE - Stani's Python Editor

Hi Steve,
Thanks for the confirmation. It is indeed good news. Feel free to send
me privately some screenshots. BTW, I just released Phatch 0.1.3 which
is the final version for Ubuntu Hardy.

Stani
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top