aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2010-02-15 20:32:23 +0100
committerOlivier Tilloy <olivier@tilloy.net>2010-02-15 20:32:23 +0100
commit5654566f491370e413f619394a01397366cc3774 (patch)
tree0967b5ab40cb283bf256fbe796fdeb4ecdb608a4 /doc
parent0e94af73385f2b387c8ad25cdfbecf63c57b9857 (diff)
downloadpyexiv2-5654566f491370e413f619394a01397366cc3774.tar.gz
Tutorial: accessing embedded previews.
Diffstat (limited to 'doc')
-rw-r--r--doc/tutorial.rst23
1 files changed, 23 insertions, 0 deletions
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')
+