WebFaction
Community site: login faq
1
1

I do a lot of work with images. Much of it involves needing to print exif data like the timestamp on them. I found a python script called Phatch http://photobatch.stani.be/ which can do everything I need.

I installed it according to http://photobatch.wikidot.com/install#toc5 and did some tests.. I was able to get scripts to do things like resize photos. When I tried to stamp exif data though I got errors. I investigated a bit and it looked like I needed to install pyexiv2 which has a number of other dependencies. I got all of those installed as well.

In my shell if I entered these commands(as directed by webfaction support)

export CPPFLAGS="-I$HOME/include $CPPFLAGS"
export CXXFLAGS="-I$HOME/include $CXXFLAGS"
export LDFLAGS="-L$HOME/lib $LDFLAGS"
export LD_LIBRARY_PATH=$HOME/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=$HOME/include:$C_INCLUDE_PATH
export LIBRARY_PATH=$HOME/lib:$LIBRARY_PATH

I was able to log into the python shell and do some tests to see that pyexiv2 was working. It seemed like I had to enter those commands every time before I log into python though or pyexiv2 would not be found.

I then tried running the the phatch script to stamp my images again and got the same error.

    Traceback (most recent call last):
  File "/home/removed/bin/phatch", line 16, in <module>
    main(config_paths, app_file = __file__)
  File "/home/removed/lib/python2.6/phatch/app.py", line 229, in main
    _console(paths, settings)
  File "/home/removed/lib/python2.6/phatch/app.py", line 194, in _console
    console.main(actionlist=paths[0], paths=paths[1:], settings=settings)
  File "/home/removed/lib/python2.6/phatch/console/console.py", line 200, in main
    Frame(actionlist, paths, settings)
  File "/home/removed/lib/python2.6/phatch/console/console.py", line 132, in __init__
    raise safe.UnsafeError(warning)
lib.safe.UnsafeError: Text Action:
  Text: The following name(s) are invalid: Exif, Image, Make

The documentation for phatch is not exactly clear to me, so I am not sure if the error is caused by the tag I am using in my script

{'fields': {'Color': '#FF0000',
                     'Font': '/usr/share/fonts/dejavu/DejaVuSansMono.ttf',
                     'Horizontal Justification': 'Right',
                     'Horizontal Offset': '100%',
                     'Orientation': u'Normal',
                     'Size': u'3 %',
                     'Position': u'Custom',
                     'Text': '<Exif.Image.Make>',
                     'Vertical Justification': 'Bottom',
                     'Vertical Offset': '100%',
                     '__enabled__': 'yes'},
          'label': 'Text'},

Or if the issue is between Phatch and Pyexiv2? I feel like it's most likely Phatch not correctly importing the pyexiv2 module?

I am pretty rusty with Linux and completely green with Python.

I am open to other solutions if anyone knows of any as well.

asked 03 Apr '13, 00:20

Paddy Martinez
1347
accept rate: 0%

edited 03 Apr '13, 10:31

seanf
12.2k41836


The error message you are seeing seems to be coming from this line in your script:

'Text': '<Exif.Image.Make>',

This suggests that pyexiv2 is installed correctly but is unable to understand this line. Maybe the syntax you're using is not compatible with the latest version of pyexiv2?

As for having to run several commands every time you log in, this is most likely do to this line:

export LD_LIBRARY_PATH=$HOME/lib:$LD_LIBRARY_PATH

The other lines are for compile-time, but this one is for run-time, and needs to be active every time you try to use the software. You may consider adding it to the end of your ~/.bashrc file so it is executed automatically when you log in.

Finally, depending on what you're attempting to do, you may want to look into jhead. That's what I typically use when needing to access or modify EXIF data. It may or may not work for what you need.

Hope that helps!

permanent link

answered 03 Apr '13, 21:13

ryans ♦♦
5.0k93360
accept rate: 43%

I cleared my home directory and started over.

Well, I got pyexiv2 importing correctly. I needed to move all the files from src/pyexiv2 into the lib/python2.6 folder.. not just the libexiv2python.so file.

I still can't figure out the proper way to call the exif tags though. Documentation for Phatch is terrible.

permanent link

answered 07 Apr '13, 17:56

Paddy Martinez
1347
accept rate: 0%

edited 07 Apr '13, 19:13

So, after trying every iteration under the sun...

I finally have this working!

If anyone is in the same boat:

{'fields': {'Color': '#FF0000', 'Font': '/usr/share/fonts/dejavu/DejaVuSansMono.ttf', 'Horizontal Justification': 'Right', 'Horizontal Offset': '100%', 'Orientation': u'Normal', 'Size': u'3 %', 'Position': u'Custom', 'Text': u'<pexif_datetimeoriginal>', 'Vertical Justification': 'Bottom', 'Vertical Offset': '100%', 'enabled': 'yes'}, 'label': 'Text'},

permanent link

answered 08 Apr '13, 20:22

Paddy Martinez
1347
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×337
×2
×1
×1
×1

question asked: 03 Apr '13, 00:20

question was seen: 2,624 times

last updated: 08 Apr '13, 20:48

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM