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

SPE - Stani's Python Editor spe.stani.be at gmail.com
Mon Feb 25 07:06:26 EST 2008


On 22 feb, 15:36, Mike Driscoll <kyoso... at gmail.com> wrote:
> > On Feb 22, 1:41 am, Mike Driscoll <kyoso... at gmail.com> wrote:
> > > I'm confused. What needs to be compiled exactly? Are there any
> > > directions? I'm not seeing any at  that website. I can give it a go if
> > > someone can give me advice.
>
> > 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.
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.

> > 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.
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
--
Phatch - PHoto bATCH processor - http://photobatch.stani.be
SPE    - Python Editor & IDE - http://pythonide.stani.be



More information about the Python-list mailing list