From 5654566f491370e413f619394a01397366cc3774 Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Mon, 15 Feb 2010 20:32:23 +0100 Subject: Tutorial: accessing embedded previews. --- doc/tutorial.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'doc') diff --git a/doc/tutorial.rst b/doc/tutorial.rst index 0574aa3..a5bc849 100644 --- a/doc/tutorial.rst +++ b/doc/tutorial.rst @@ -209,3 +209,26 @@ pair (see exiv2's documentation for a list of valid >>> value = 'A beautiful picture.' >>> metadata[key] = pyexiv2.XmpTag(key, value) +Accessing embedded previews +########################### + +Images may embed previews (also called thumbnails) of various sizes in their +metadata. pyexiv2 allows to easily access them:: + + >>> previews = metadata.previews + + >>> len(previews) + 2 + +They are sorted by increasing size. Let's play with the largest one:: + + >>> largest = previews[-1] + + >>> largest.dimensions + (320, 240) + + >>> largest.mime_type + 'image/jpeg' + + >>> largest.write_to_file('largest') + -- cgit