228 lines
9.0 KiB
HTML
228 lines
9.0 KiB
HTML
__doctype__
|
||
<html lang="en">
|
||
__header4__
|
||
|
||
<body>
|
||
__navbar__
|
||
|
||
<div class="container">
|
||
<div class="page-header">
|
||
<h1>Library examples</h1>
|
||
</div>
|
||
|
||
<h2 id="example1">Example 1: exifprint.cpp</h2>
|
||
|
||
<p class="lead">This is a very simple program to read and print the Exif metadata
|
||
of an image. Go to <a title="Sample usage of high-level metadata operations"
|
||
href="#example2-output">Example2</a> to see how the
|
||
output looks like.</p>
|
||
|
||
__example1__
|
||
|
||
<p> </p>
|
||
<hr>
|
||
<h2 id="example2">Example 2: addmoddel.cpp</h2>
|
||
|
||
<p class="lead">Sample usage of high-level Exiv2 library calls to add, modify and delete Exif metadata.</p>
|
||
|
||
__example2__
|
||
|
||
<p> </p>
|
||
<div class="row">
|
||
<div class="col-md-8">
|
||
<p id="example2-output">Using the print function from
|
||
<a title="Reading and printing the Exif metadata of an image"
|
||
href="#example1">Example1</a> shows the
|
||
following Exif tags in the image. Note the tag
|
||
<code>Exif.Image.ExifTag</code>: It is required by the Exif standard because
|
||
the metadata contains an <code>Exif.Photo.*</code> tag and is automatically
|
||
added by Exiv2 to ensure that the Exif structure is valid.</p>
|
||
|
||
<pre>
|
||
<span class="stringliteral">$ exifprint img_2158.jpg</span>
|
||
Exif.Image.Model 0x0110 Ascii 7 Test 1
|
||
Exif.Image.SamplesPerPixel 0x0115 Short 1 162
|
||
Exif.Image.XResolution 0x011a SLong 1 -2
|
||
Exif.Image.YResolution 0x011b SRational 1 -2/3
|
||
Exif.Image.ExifTag 0x8769 Long 1 89
|
||
Exif.Photo.DateTimeOriginal 0x9003 Ascii 20 2000:12:31 23:59:59
|
||
</pre>
|
||
|
||
</div><!-- /.col-md-8 -->
|
||
<div class="col-md-4">
|
||
<img src="include/img_2158.jpg" class="img-responsive img-rounded center-block" title="img_2158.jpg (28036 Bytes)" alt="Image containing the Exif metadata from example 2">
|
||
<p class="text-center text-muted"><em>Image with the Exif metadata from example 2</em></p>
|
||
</div><!-- /.col-md-4 -->
|
||
</div><!-- /.row -->
|
||
|
||
<hr>
|
||
<h2 id="example3">Example 3: iptcprint.cpp</h2>
|
||
|
||
<p class="lead">This is a very simple program to read and print the IPTC metadata of an image.</p>
|
||
|
||
__example3__
|
||
|
||
<p> </p>
|
||
<div class="row">
|
||
<div class="col-md-9">
|
||
<pre>
|
||
<span class="stringliteral">$ iptcprint smiley1.jpg</span>
|
||
Iptc.Application2.Headline 0x0069 String 17 The headline I am
|
||
Iptc.Application2.Keywords 0x0019 String 19 Yet another keyword
|
||
Iptc.Application2.DateCreated 0x0037 Date 8 2004-08-03
|
||
Iptc.Application2.Urgency 0x000a String 5 very!
|
||
Iptc.Envelope.ModelVersion 0x0000 Short 1 42
|
||
Iptc.Envelope.TimeSent 0x0050 Time 11 14:41:00-05:00
|
||
Iptc.Application2.RasterizedCaption 0x007d Undefined 8 230 42 34 2 90 84 23 146
|
||
Iptc.0x0009.0x0001 0x0001 String 9 Who am I?
|
||
</pre>
|
||
</div><!-- /.col-md-9 -->
|
||
<div class="col-md-3">
|
||
<img src="include/smiley1.jpg" id="smiley1" class="img-responsive img-thumbnail center-block" title="smiley1.jpg (2909 Bytes)" alt="Sample image with the IPTC data from example 3">
|
||
<p class="text-center text-muted"><em>Image with the IPTC data<br>from examples 3 & 4</em></p>
|
||
</div><!-- /.col-md-3 -->
|
||
</div><!-- /.row -->
|
||
|
||
<hr>
|
||
<h2 id="example4">Example 4: iptceasy.cpp</h2>
|
||
|
||
<p class="lead">This shows the quickest way to access, set or modify IPTC metadata, which is similar to how <code>std::map</code> works.
|
||
The sample program writes the IPTC data to a file. <a title="Reading and printing the IPTC metadata of an image"
|
||
href="#smiley1">Example 3</a>, above, has the image with this IPTC data.</p>
|
||
|
||
__example4__
|
||
|
||
<p> </p>
|
||
<hr>
|
||
<h2 id="example5">Example 5: xmpsample.cpp</h2>
|
||
|
||
<p class="lead">Sample (test) usage of high level XMP classes. This example shows various aspects
|
||
of setting XMP metadata, including complex types. See also <a href="#example2">Example 2: addmoddel.cpp</a></p>
|
||
|
||
__example5__
|
||
|
||
<p> </p>
|
||
<p>The resulting XMP Exiv2 metadata and XMP packet is below.
|
||
The same can be achieved with a set of <a href="sample.html#xmp">commands</a>
|
||
to the Exiv2 command line tool.</p>
|
||
|
||
<div id="example5-output"><pre>
|
||
<span class="stringliteral">$ xmpsample</span>
|
||
Xmp.dc.source XmpText 13 xmpsample.cpp
|
||
Xmp.dc.subject XmpBag 2 Palmtree, Rubbertree
|
||
Xmp.dc.title LangAlt 2 lang="de-DE" Sonnenuntergang am Strand, lang="en-US" Sunset on the beach
|
||
Xmp.dc.one XmpText 2 -1
|
||
Xmp.dc.two XmpText 6 3.1415
|
||
Xmp.dc.three XmpText 3 5/7
|
||
Xmp.dc.four XmpText 3 255
|
||
Xmp.dc.five XmpText 3 256
|
||
Xmp.dc.six XmpText 5 false
|
||
Xmp.dc.seven XmpText 5 Seven
|
||
Xmp.dc.format XmpText 10 image/jpeg
|
||
Xmp.dc.creator XmpSeq 3 1) The first creator, 2) The second creator, 3) And another one
|
||
Xmp.dc.description LangAlt 2 lang="x-default" Hello, World, lang="de-DE" Hallo, Welt
|
||
Xmp.tiff.ImageDescription LangAlt 2 lang="x-default" TIFF image description, lang="de-DE" TIFF Bildbeschreibung
|
||
Xmp.xmpDM.videoFrameSize/stDim:w XmpText 2 16
|
||
Xmp.xmpDM.videoFrameSize/stDim:h XmpText 1 9
|
||
Xmp.xmpDM.videoFrameSize/stDim:unit XmpText 4 inch
|
||
Xmp.dc.publisher XmpBag 1 James Bond
|
||
Xmp.dc.publisher[1]/?ns:role XmpText 12 secret agent
|
||
Xmp.dc.creator[2]/?ns:role XmpText 10 programmer
|
||
Xmp.xmpBJ.JobRef XmpText 0 type="Bag"
|
||
Xmp.xmpBJ.JobRef[1]/stJob:name XmpText 14 Birthday party
|
||
Xmp.xmpBJ.JobRef[1]/stJob:role XmpText 12 Photographer
|
||
Xmp.xmpBJ.JobRef[2]/stJob:name XmpText 16 Wedding ceremony
|
||
Xmp.xmpBJ.JobRef[2]/stJob:role XmpText 8 Best man
|
||
|
||
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
|
||
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.1.1-Exiv2">
|
||
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
||
<rdf:Description rdf:about=""
|
||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||
xmlns:ns="myNamespace/"
|
||
xmlns:tiff="http://ns.adobe.com/tiff/1.0/"
|
||
xmlns:xmpDM="http://ns.adobe.com/xmp/1.0/DynamicMedia/"
|
||
xmlns:stDim="http://ns.adobe.com/xap/1.0/sType/Dimensions#"
|
||
xmlns:xapBJ="http://ns.adobe.com/xap/1.0/bj/"
|
||
xmlns:stJob="http://ns.adobe.com/xap/1.0/sType/Job#"
|
||
dc:source="xmpsample.cpp"
|
||
dc:one="-1"
|
||
dc:two="3.1415"
|
||
dc:three="5/7"
|
||
dc:four="255"
|
||
dc:five="256"
|
||
dc:six="false"
|
||
dc:seven="Seven"
|
||
dc:format="image/jpeg">
|
||
<dc:subject>
|
||
<rdf:Bag>
|
||
<rdf:li>Palmtree</rdf:li>
|
||
<rdf:li>Rubbertree</rdf:li>
|
||
</rdf:Bag>
|
||
</dc:subject>
|
||
<dc:title>
|
||
<rdf:Alt>
|
||
<rdf:li xml:lang="de-DE">Sonnenuntergang am Strand</rdf:li>
|
||
<rdf:li xml:lang="en-US">Sunset on the beach</rdf:li>
|
||
</rdf:Alt>
|
||
</dc:title>
|
||
<dc:creator>
|
||
<rdf:Seq>
|
||
<rdf:li>1) The first creator</rdf:li>
|
||
<rdf:li rdf:parseType="Resource">
|
||
<rdf:value>2) The second creator</rdf:value>
|
||
<ns:role>programmer</ns:role>
|
||
</rdf:li>
|
||
<rdf:li>3) And another one</rdf:li>
|
||
</rdf:Seq>
|
||
</dc:creator>
|
||
<dc:description>
|
||
<rdf:Alt>
|
||
<rdf:li xml:lang="x-default">Hello, World</rdf:li>
|
||
<rdf:li xml:lang="de-DE">Hallo, Welt</rdf:li>
|
||
</rdf:Alt>
|
||
</dc:description>
|
||
<dc:publisher>
|
||
<rdf:Bag>
|
||
<rdf:li rdf:parseType="Resource">
|
||
<rdf:value>James Bond</rdf:value>
|
||
<ns:role>secret agent</ns:role>
|
||
</rdf:li>
|
||
</rdf:Bag>
|
||
</dc:publisher>
|
||
<tiff:ImageDescription>
|
||
<rdf:Alt>
|
||
<rdf:li xml:lang="x-default">TIFF image description</rdf:li>
|
||
<rdf:li xml:lang="de-DE">TIFF Bildbeschreibung</rdf:li>
|
||
</rdf:Alt>
|
||
</tiff:ImageDescription>
|
||
<xmpDM:videoFrameSize
|
||
stDim:w="16"
|
||
stDim:h="9"
|
||
stDim:unit="inch"/>
|
||
<xapBJ:JobRef>
|
||
<rdf:Bag>
|
||
<rdf:li
|
||
stJob:name="Birthday party"
|
||
stJob:role="Photographer"/>
|
||
<rdf:li
|
||
stJob:name="Wedding ceremony"
|
||
stJob:role="Best man"/>
|
||
</rdf:Bag>
|
||
</xapBJ:JobRef>
|
||
</rdf:Description>
|
||
</rdf:RDF>
|
||
</x:xmpmeta>
|
||
<?xpacket end="w"?>
|
||
</pre></div>
|
||
|
||
</div><!-- /.container -->
|
||
__footer__
|
||
__bootstrap__
|
||
|
||
<!-- Custom script to bootstrap (augment) Doxygen-generated HTML -->
|
||
<script type="text/javascript" src="doc/doxy-boot.js"></script>
|
||
|
||
</body>
|
||
</html>
|