Project

xmpr

0.01
Low commit activity in last 3 years
No release in over a year
Parse XMP data extracted from an image into rich data types
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
>= 0

Runtime

~> 1.6
 Project Readme

XMP Reader

XMP Reader in Ruby. Parse XMP data extracted from an image into rich data types.

Usage

Use something like imagemagick to extract the XMP, then read it with this class:

require "xmpr"
raw_xmp = `convert image.jpg xmp:-`
xmp = XMPR.parse(raw_xmp)
xmp["dc", "title"] # => "Amazing Photo"
xmp["photoshop", "Category"] # => "summer"
xmp["photoshop", "SupplementalCategories"] # => ["morning", "sea"]

The xmp instance fetches namespaced attributes. You can use fully qualified namespaces, or some namespaces have shortcuts:

xmp["http://purl.org/dc/elements/1.1/", "title"] # => "Amazing Photo"
xmp["dc", "title"] # => "Amazing Photo" (same thing)

The following namespaces have shortcuts:

  • auxhttp://ns.adobe.com/exif/1.0/aux/
  • cchttp://creativecommons.org/ns# (Creative Commons)
  • crshttp://ns.adobe.com/camera-raw-settings/1.0/
  • dchttp://purl.org/dc/elements/1.1/ (Dublin Core)
  • exifhttp://ns.adobe.com/exif/1.0/
  • Iptc4xmpCorehttp://iptc.org/std/Iptc4xmpCore/1.0/xmlns/ (IPTC)
  • pdfhttp://ns.adobe.com/pdf/1.3/
  • photoshophttp://ns.adobe.com/photoshop/1.0/
  • rdfhttp://www.w3.org/1999/02/22-rdf-syntax-ns#
  • tiffhttp://ns.adobe.com/tiff/1.0/
  • xadobe:ns:meta/
  • xaphttp://ns.adobe.com/xap/1.0/
  • xmphttp://ns.adobe.com/xap/1.0/ (XMP)
  • xmpidqhttp://ns.adobe.com/xmp/Identifier/qual/1.0/
  • xmpBJhttp://ns.adobe.com/xap/1.0/bj/
  • xmpRightshttp://ns.adobe.com/xap/1.0/rights/
  • xmpMMhttp://ns.adobe.com/xap/1.0/mm/
  • xmpTPghttp://ns.adobe.com/xap/1.0/t/pg/

Thanks

Refactored from XMP. Inspired by ExifTool.

References

License

MIT license, see LICENSE.