Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Extract XMP from JPG or TIF Image File Ruby script to extract an embedded XMP from a JPEG or TIFF image file.
# file: xmpExtract.rb
require 'chilkat'
# Extract XMP metadata from a JPG or TIF image file.
xmp = Chilkat::CkXmp.new()
success = xmp.UnlockComponent("Anything for 30-day trial")
if not success
xmp.SaveLastError("errorLog.txt")
exit
end
success = xmp.LoadAppFile("images/xmpExample.jpg")
if not success
xmp.SaveLastError("errorLog.txt")
exit
end
# How many embedded XMP documents in the image file?
numEmbedded = xmp.get_NumEmbedded()
if (numEmbedded == 0)
print "This JPG does not have embedded XMP metadata\n"
exit
end
# Retrieve the 1st XMP document as a CkXml object.
# (There is usually only a single embedded XMP)
xml = xmp.GetEmbedded(0)
xml.SaveXml("output/xmpDoc.xml")
print("XMP extracted!\n")
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.