Ruby Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

Ruby
Examples

Quick Start
Unicode
Byte Array
Bz2
Certificates
CSV
Email
Encryption
FTP
HTML Conversion
HTTP
IMAP
MHT
MIME
POP3
RSA
S/MIME
Signatures
SFTP
SMTP
Socket / SSL
Spider
SSH
SSH Key
SSH Tunnel
Tar
HTTP Upload
XML
XMP
Zip

More Examples...
String
Amazon S3
Email Object
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
DH Key Exchange
DSA
LZW

 

 

 

 

 

 

 

Copy XMP Metadata from one JPEG file to another

Downloads for Windows/Linux and Install Instructions

Copy the XMP metadata from one JPG image file to another.

# file: xmpCopy.rb

require 'rubygems'
require 'chilkat'

# Copy XMP metadata from one JPG to another.
xmp = Chilkat::CkXmp.new()
success = xmp.UnlockComponent("Anything for 30-day trial")
if not success
	xmp.SaveLastError("errorLog.txt")
	exit
end

# Load a JPG containing XMP metadata.
success = xmp.LoadAppFile("images/xmpExample.jpg")
if not success
	xmp.SaveLastError("errorLog.txt")
	exit
end

# Load a JPG that does not contain XMP metadata.
xmp2 = Chilkat::CkXmp.new()
success = xmp2.LoadAppFile("images/starfish.jpg")
if not success
	xmp2.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)

# Add it to starfish.jpg
# (The JPG file is not updated until SaveAppFile is called.)
xmp2.Append(xml)

# Save it.
xmp2.SaveAppFile("output/starfish.jpg")











 

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