|Daniel Aleksandersen f67e7787a5|
embed_xmp is a Ruby gem that lets you embed Extensible Metadata (XMP) (ISO 16684-1:2019) sidecar files into image files. It can be useful if you want to embed licensing, copyright, descriptions, accessive information, or other metadata into your photo files for distribution on the web and other digital channels.
It will not help you author XMP files, usually provided along with your photo files, and it will not validate the XMP data you try to embed. It will ensure that the XML is well-formatted, however. XMP is embedded as-is, except for non-destructive whitespace reduction to keep file sizes small.
The gem is not aware of other metadata formats and will not reconcile them with the XMP data. You must either remove other metadata formats from the file, or reconcile their records with the XMP data you embed.
Supported image formats:
The XMP sidecar will be wrapped in an XPACKET when embedded.
You probably want to install it via RubyGems:
gem install embed_xmp
To build and install the gem:
gem build embed_xmp.gemspec gem install embed_xmp*.gem
embed_xmp sidecar.xmp input.png output.png
require 'embed_xmp' # Embed a sidecar file into a PNG image. EmbedXMP::PNG.join_sidecar(xmp_sidecar_path, input_path, output_path) # Copy XMP data in a string into a JPEG image. xmp_data = "<x:xmpmeta/>" EmbedXMP::JPEG.join_sidecar(xmp_data, input_path, output_path)
Documentation on RubyDoc.