Skip to content

envato/xmpr

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

XMP Reader in Ruby

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%