Storing metadata in files

Creative Commons

The non-profit Creative Commons organization distributes a variety of easily applicable free licenses for digital works [17] that artists and authors worldwide use to protect their copyrights. Creative Commons recommends XMP as a metadata format. At the same time, the organization posts guidelines on how artists can best utilize the information of the license they use [18] and embed this in their published files. This creates a win-win situation: The license strengthens the position of the author, and the users establish the license conditions in an uncomplicated and reliable way from the objects themselves.

Creative Commons has defined the XML namespace for XMP, as well as for other purposes; this includes the following four elements cc:license, cc:morePermissions, cc:attributionURL, and cc:attributionName. The XMP Toolkit makes this namespace available under the consts.XMP_NS_CC key. Furthermore, the organization recommends the use of the two elements xmpRights:Marked and xmpRights:UsageTerms from the XMP rights management schema (Table 1).

A copy of the license notice should also (according to their advice) end up in dc:rights. Listing 3 shows a Python script that writes the metadata recommended by Creative Commons into a JPG file (not yet containing an XMP packet) with XMP Toolkit for the Attribution-ShareAlike 4.0 license. The result of these efforts is presented in Listing 4.

Listing 3

Generating Creative Commons-Compliant Metadata


Listing 4

Created XMP Package


The xmpRights:WebStatement text element transports a callable URL, by which details regarding the authorship and conditions of use of a file can be verified. The Creative Commons creators suggest installing a reference under the address given here that also contains the hash value of the published file [19]. In this case, it can be manually or automatically compared to raise the alarm in case of forgeries.


XMP involves a sophisticated and professional metadata system that compiles schemas for different objects and applications. The comprehensive set of descriptive components can even be expanded with elements not provided by the specification.

XMP supports a wide range of file formats in which to embed metadata packets; it is only on exceptional occasions that no solution exists. Nothing else is comparable, especially when it comes to PDF documents, although this is not surprising considering the standard's author (Adobe).

End users can request XMP metadata with ease from the command line, and programmers can develop special XMP applications with a range of C/C++ libraries. Python bindings are available for the existing XMP and Exif libraries, which can also handle XMP.

Exiftool (in the libimage-exiftool-perl Debian package or perl-image-exiftool package for openSUSE and others) and the command-line tool from the Exiv2 library (in the Debian exiv2 package) are also useful for editing XMP data at the command line.

The Author

Daniel Stender has been keeping busy e-documenting since finishing a humanities degree. He is a Debian developer and, among other things, the maintainer of the Python XMP Toolkit.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Programmatically change YouTube metadata

    Instead of manually editing the metadata of YouTube movies, video craftsman Mike Schilli dips into YouTube’s API spell book and lets a script automatically do the work.

  • Bcfg2

    The powerful Bcfg2 provides a sophisticated environment for centralized configuration management.

  • KTools: Treeline

    Mindmaps are useful for organizing ideas and data. Treeline is a promising mindmap tool for KDE.

  • Tutorials – ODF Metadata

    It is no secret that the native file format of LibreOffice and OpenOffice, the OpenDocument Format (ODF), is a truly open standard for word processing documents, spreadsheets, and presentations. What most people do not know is that ODF files contain lots of metadata that is very easy to read or modify.

  • Metadata Analysis

    Detect operating systems, installed software, and more from easily collected metadata.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95