Project

General

Profile

getting a single tags value

Added by andreas schmid about 11 years ago

hi,
is there a way to get a single tags value?

if i only want the Xmp.dc.subject without the need to grep over the whole result?

thanx


Replies (7)

RE: getting a single tags value - Added by Andreas Huggel about 11 years ago

Assuming you're using the exiv2 command line tool, check out the -g option. Or is that what you say you don't want?

RE: getting a single tags value - Added by andreas schmid about 11 years ago

what if i dont see any -g option in my man page?
im on exiv2 0.19 installed with macports

RE: getting a single tags value - Added by Andreas Huggel about 11 years ago

Right. You need 0.20 for that

RE: getting a single tags value - Added by Steve Wright about 11 years ago

I do love that -g option. Though it does have one drawback/shortcoming (I'm wary of calling it a bug, being one of those who suggested it to Andreas in the first place), described here: http://dev.exiv2.org/boards/3/topics/662 .

Well worth taking all the necessary steps and putting up with the headaches (which may or may not occur, macports being planets away from Cygwin) to upgrade to 0.20. Or you may just want to hand-tool a BASH script to grep/cut/sed your desired tag values until Andreas rolls out 0.21.

Choice is yours. I'd do the latter, frankly. Can't wait for that better error-trapping. :)

Steve Wright.

RE: getting a single tags value - Added by andreas schmid about 11 years ago

i upgraded to the latest version but im still not that happy with the output.
usually if i query for a key i want it to return the value not the whole table row.

what should be done here is an option like -Pgv which prints the value for a single key. otherwise i still have to parse what i get on print.

any solution for that?

p.s. have to say im using the command inside a python script to parse the metadata values of images.

RE: getting a single tags value - Added by Andreas Huggel about 11 years ago

You can use the grep and print options together, as in exiv2 -g Exif.Image.Make -Pv image.jpg
If you want full control over your metadata from a python script, try pyexiv2, the Python wrapper for Exiv2.

Andreas

RE: getting a single tags value - Added by andreas schmid about 11 years ago

thx for the hint. i tried this already but it didn't work for some reason. now it does... maybe i wasn't using the right syntax.
i already tried pyexiv2 and it works fine but i need to write into a custom xmp namespace and pyexiv2 does not support registering new namespaces.

    (1-7/7)