Ruby Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript



Ruby
Examples

Quick Start
Ruby Unicode
Ruby Byte Array
Ruby Certs
Ruby Email
Ruby Encryption
Ruby FTP
HTML-to-XML
Ruby HTTP
Ruby IMAP
Ruby MHT
Ruby MIME
Ruby S/MIME
Ruby Signatures
Ruby RSA
Ruby Socket
Ruby Spider
Ruby Tar
Ruby Upload
Ruby XML
Ruby XMP
Ruby Zip

More Examples...
String
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
DH Key Exchange
DSA
SSH Key
SSH
SSH Tunnel
SFTP

Unreleased...
LZW
Bz2
Icon

 

 

 

 

 

 

 

Add XMP Metadata to TIF or JPG

Ruby example to add XMP metadata to a TIFF or JPEG image.

Download Ruby Programming Example Scripts

# file: xmpAddMetadata.rb

require 'chilkat'

# Add XMP metadata to a JPG or TIF image that does not yet have XMP metadata.
xmp = Chilkat::CkXmp.new()
success = xmp.UnlockComponent("Anything for 30-day trial")
if not success
	xmp.SaveLastError("errorLog.txt")
	exit
end

# Both JPEG and TIFF files are supported.
success = xmp.LoadAppFile("images/dudeRuby.tif")
if not success
	xmp.SaveLastError("errorLog.txt")
	exit
end

# Create a new XMP document.
xml = Chilkat::CkXml.new()
xmp.NewXmp(xml)

# Add some properties:
# <exif:PixelXDimension>432</exif:PixelXDimension>
# <exif:PixelYDimension>288</exif:PixelYDimension>

xmp.AddSimpleInt(xml,"exif:PixelXDimension",150)
xmp.AddSimpleInt(xml,"exif:PixelYDimension",150)

# Append it and save the image.  The "out.tif" file now contains XMP metadata.
xmp.Append(xml)
xmp.SaveAppFile("output/dudeRuby.tif")

# Save the XMP to an XML file so we can see what was embedded.
xml.SaveXml("output/newXmp.xml");

# This is the XMP document that is added to the TIF:
# <?xml version="1.0" encoding="utf-8" ?>
# 
# <x:xmpmeta xmlns:x="adobe:ns:meta/">
# <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
# <rdf:Description rdf:about="uuid:e402387b-3bf5-4c8e-b519-9c250de72c65" xmlns:exif="http://ns.adobe.com/exif/1.0/">
# <exif:PixelXDimension>150</exif:PixelXDimension>
# <exif:PixelYDimension>150</exif:PixelYDimension>
# </rdf:Description>
# </rdf:RDF>
# </x:xmpmeta>





 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2008 Chilkat Software, Inc. All Rights Reserved.