From 59a385ba4c24fd08203a324bc1abd947a04ee8af Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Mon, 5 Oct 2009 10:03:31 +0200 Subject: Added a quick main that kind of mimics the output of exiv2 for an image. --- src/pyexiv2.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/pyexiv2.py b/src/pyexiv2.py index 1cf7eb5..2a1d6ba 100644 --- a/src/pyexiv2.py +++ b/src/pyexiv2.py @@ -1550,3 +1550,21 @@ class ImageMetadata(object): except AttributeError: raise KeyError(key) + +if __name__ == '__main__': + import sys + args = sys.argv + + if len(args) != 2: + print 'Usage: %s image_file' % args[0] + sys.exit(-1) + + metadata = ImageMetadata(args[1]) + metadata.read() + + for key in metadata.exif_keys: + tag = metadata[key] + print '%-45s%-11s%s' % (key, tag.type, str(tag)) + + # TODO: print IPTC and XMP tags. + -- cgit