CkXmp Python Programming Reference Documentation
CkXmp
Chilkat XMP is a software component (SDK, toolkit, library, etc) for accessing, manipulating, and adding XMP metadata to JPEG and TIFF files.
Object Creation
obj = chilkat.CkXmp()
Properties
# str is a CkString object (output) LastErrorHtml( str )
Error information in HTML format for the last method called.
# str is a CkString object (output) LastErrorText( str )
Error information in plain-text format for the last method called.
# str is a CkString object (output) LastErrorXml( str )
Error information in XML format for the last method called.
# Returns an integer value get_NumEmbedded( )
The number of XMP metadata documents found within the JPG or TIFF file loaded by LoadAppFile.
# Returns a boolean value get_StructInnerDescrip( )
Determines whether structures are stored with rdf:parseType="Resource", or within an "rdf:Description" sub-node.
# Returns a boolean value get_Utf8( )
# b is a boolean (input) put_Utf8( b )
When set to true, all "const char *" arguments are expected to be utf-8 strings. If set to false, the "const char *" arguments are expected to be ANSI strings.
# strOut is a CkString object (output) get_Version( strOut )
The version, such as "1.0" of the XMP toolkit.
Methods
# arrType is a string (input) # propName is a string (input) # values is a CkStringArray object (output) # Returns a boolean value AddArray( xml, arrType, propName, values )
Adds or replaces an XMP property array. The XMP metadata to be updated is contained in the XML object passed in the 1st argument. The 2nd argument specifies the array type, which can be "bag", "seq", or "alt". The property name should be prefixed with the namespace, such as "dc:subject".
# ns is a string (input) # uri is a string (input) AddNsMapping( ns, uri )
Adds a namespace to URI mapping. When a property is added via AddSimpleString or any of the other methods, the property name is namespace qualified. When adding the first property in a namespace, the rdf:Description is automatically added and the URI is obtained from the namespace-to-URI mappings. The standard (and commonly used) namespace mappings are defined by default. This is only used if the namespace is custom or not already handled.
# propName is a string (input) # sysTime is a SYSTEMTIME object (output) # Returns a boolean value AddSimpleDate( xml, propName, sysTime )
Adds or replaces an XMP date property. The XMP metadata to be updated is contained in the XML object passed in the 1st argument. The property name should be prefixed with the namespace, such as "xap:CreateDate".
# propName is a string (input) # propVal is an integer (input) # Returns a boolean value AddSimpleInt( xml, propName, propVal )
Adds or updates an XMP integer property. The XMP metadata to be updated is contained in the XML object passed in the 1st argument. The property name should be prefixed with the namespace, such as "tiff:XResolution".
# propName is a string (input) # propVal is a string (input) # Returns a boolean value AddSimpleStr( xml, propName, propVal )
Adds or updates a simple XMP string property. The XMP metadata to be updated is contained in the XML object passed in the 1st argument. The property name should be prefixed with the namespace, such as "photoshop:Credit".
# structName is a string (input) # propName is a string (input) # propVal is a string (input) # Returns a boolean value AddStructProp( xml, structName, propName, propVal )
Adds or updates an XMP structured property value. The XMP metadata to be updated is contained in the XML object passed in the 1st argument. The structure name should be prefixed with the namespace, such as "Iptc4xmpCore:CreatorContactInfo". The property name within the structure should also be prefixed with the namespace, such as "Iptc4xmpCore:CiAdrCity".
# Returns a boolean value Append( xml )
Appends a new XMP metadata file to the XMP object. Any XMPs appended via this method will be present in the file when SaveAppFile is called. Files containing XMP metadata typically only include a single XMP document, so this method is usually only called when adding XMP metadata to a file for the first time.
# sysTime is a SYSTEMTIME object (output) # strOut is a CkString object (output) # Returns a boolean value DateToString( sysTime, strOut )
Converts a date to a string representation. This method is added for convenience (just in case date-to-string conversions are required). Returns True for success, False for failure.
# propName is a string (input) # array is a CkStringArray object (output) # Returns a boolean value GetArray( xml, propName, array )
Finds and returns an XMP array property. The property name should be prefixed with the namespace, such as "dc:subject".
# index is an integer (input) # Returns a CkXml object GetEmbedded( index )
Returns the Nth embedded XMP document as a Chilkat XML object.
# propName is a string (input) # sysTime is a SYSTEMTIME object (output) # Returns a boolean value GetSimpleDate( xml, propName, sysTime )
Finds and returns an XMP date property. The property name should be prefixed with the namespace, such as "xap:ModifyDate".
# propName is a string (input) # Returns an integer value GetSimpleInt( xml, propName )
Finds and returns an XMP integer property. The property name should be prefixed with the namespace, such as "tiff:ResolutionUnit".
# propName is a string (input) # strOut is a CkString object (output) # Returns a boolean value GetSimpleStr( xml, propName, strOut )
Finds and returns an XMP simple string property. The property name should be prefixed with the namespace, such as "photoshop:Source". Returns True for success, False for failure.
# structName is a string (input) # array is a CkStringArray object (output) # Returns a boolean value GetStructPropNames( xml, structName, array )
Returns the property names used by an exsting structure within an XMP document. The contents of the structure can be retrieved by calling GetStructValue for each property name returned by GetStructPropNames.
# structName is a string (input) # propName is a string (input) # strOut is a CkString object (output) # Returns a boolean value GetStructValue( xml, structName, propName, strOut )
Returns the value of a single item within an XMP structure property. Property names should always be prefixed with the namespace. Returns True for success, False for failure.
# filename is a string (input) # Returns a boolean value LoadAppFile( filename )
Loads a TIFF or JPG file into the XMP object.
# byteData is a CkByteData object (output) # ext is a string (input) # Returns a boolean value LoadFromBuffer( byteData, ext )
Loads a JPG or TIFF from an byte buffer containing the image file data.
NewXmp( xmlOut )
Creates and returns a new/empty XMP metadata document as a Chilkat XML object.
RemoveAllEmbedded( )
Removes all XMP metadata documents from an XMP object. After calling this method, call SaveAppFile to rewrite the JPG or TIFF file with the XMP metadata removed.
# propName is a string (input) # Returns a boolean value RemoveArray( xml, propName )
Removes an XMP array property from the XMP document.
# index is an integer (input) RemoveEmbedded( index )
Removes a single XMP metadata document from the JPG or TIFF file. Call SaveAppFile to persist the changes to disk.
# ns is a string (input) RemoveNsMapping( ns )
Removes a namespace-to-URI mapping.
# propName is a string (input) # Returns a boolean value RemoveSimple( xml, propName )
Removes a simple XMP property from the XMP document.
# structName is a string (input) # Returns a boolean value RemoveStruct( xml, structName )
Removes an XMP structure property from the XMP document.
# structName is a string (input) # propName is a string (input) # Returns a boolean value RemoveStructProp( xml, structName, propName )
Removes a single member from an XMP structured property.
# filename is a string (input) # Returns a boolean value SaveAppFile( filename )
Persists all changes made to the XMP document(s) by saving the XMP object to a file. Changes made by adding, updating, or removing properties are not persisted to the filesystem until this is called.
# filename is a string (input) # Returns a boolean value SaveLastError( filename )
Saves the last error information to an XML formatted file.
# byteData is a CkByteData object (output) # Returns a boolean value SaveToBuffer( byteData )
Saves a JPG or TIFF image with updated XMP to a byte buffer.
# str is a string (input) # sysTime is a SYSTEMTIME object (output) # Returns a boolean value StringToDate( str, sysTime )
Converts a string to a date value. This method is added for convenience (just in case string-to-date conversions are required).
# unlockCode is a string (input) # Returns a boolean value UnlockComponent( unlockCode )
Unlocks the XMP component at runtime. This must be called once at the beginning of your application. Passing an arbitrary value initiates a fully-functional 30-day trial. A permanent unlock code is required to use the component beyond 30 days.
# sysTime is a SYSTEMTIME object (output) # Returns a string dateToString( sysTime )
Converts a date to a string representation. This method is added for convenience (just in case date-to-string conversions are required).
# propName is a string (input) # Returns a string getSimpleStr( xml, propName )
Finds and returns an XMP simple string property. The property name should be prefixed with the namespace, such as "photoshop:Source".
# structName is a string (input) # propName is a string (input) # Returns a string getStructValue( xml, structName, propName )
Returns the value of a single item within an XMP structure property. Property names should always be prefixed with the namespace.
# Returns a string lastErrorHtml( )
Error information in HTML format for the last method called.
# Returns a string lastErrorText( )
Error information in plain-text format for the last method called.
# Returns a string lastErrorXml( )
Error information in XML format for the last method called.
# val is a boolean (input) set_StructInnerDescrip( val )
If true (or nonzero) then structure properties use an inner "rdf:Description" node. Otherwise the property is created using a "rdf:parseType = Resource" attribute.
# propName is a string (input) # Returns a string simpleStr( xml, propName )
Finds and returns an XMP simple string property. The property name should be prefixed with the namespace, such as "photoshop:Source".
# structName is a string (input) # propName is a string (input) # Returns a string structValue( xml, structName, propName )
Returns the value of a single item within an XMP structure property. Property names should always be prefixed with the namespace.
# Returns a string version( )
The version, such as "1.0" of the XMP toolkit.
|