---
product: Chilkat
product_version: 11.7.0
language: wc
language_label: Unicode C
class: Xmp
license: bundle
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/wc_CkXmpWRef.html
---
# Chilkat Xmp — Unicode C — v11.7.0

> Chilkat 11.7.0 · language=wc · class=Xmp
> Other versions: replace `11.7.0` in this URL. Other languages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/<lang>/classes/Xmp.md`.
> Language-wide rules (install, unlock, error model, strings/bytes): `https://www.chilkatsoft.com/ai-docs/v/11.7.0/wc/guide.md`.

## Purpose

**Read, modify, add, remove, and save XMP metadata in JPG and TIFF files.**

`Chilkat.Xmp` is a legacy class for working with embedded XMP metadata in `JPG` and `TIFF` image files. It can load image files or image data from memory, locate embedded XMP documents, return XMP metadata as `Chilkat.Xml`, create new XMP documents, add or update simple string and integer properties, manage arrays and structured properties, add namespace mappings, remove selected XMP properties or entire embedded XMP documents, and save the updated image back to a file or byte buffer.

**Legacy class:** `Chilkat.Xmp` is maintained for existing JPG/TIFF XMP workflows, but it is not planned to be extended to support additional file types.

**Load JPG or TIFF metadata**

Load a `JPG` or `TIFF` file from disk or memory and inspect how many embedded XMP documents were found.

**Access XMP as XML**

Retrieve embedded XMP documents as `Chilkat.Xml` objects for inspection, editing, or direct XML-level processing.

**Add simple properties**

Add or update namespace-qualified string and integer properties such as `dc:subject`, `photoshop:Credit`, or `tiff:XResolution`.

**Arrays and structures**

Work with XMP arrays such as `bag`, `seq`, and `alt`, and manage structured property values.

**Namespaces**

Use built-in namespace mappings or add custom namespace-to-URI mappings for application-specific XMP properties.

**Remove and save**

Remove properties, arrays, structures, or embedded XMP documents, then persist changes to a file or return the updated image as a byte buffer.

**Common pattern:** Load a JPG or TIFF with `LoadAppFile` or `LoadFromBuffer`, retrieve an embedded XMP document with `GetEmbedded` or create one with `NewXmp`, modify it using the add/remove property methods, then call `SaveAppFile` or `SaveToBuffer` to persist the updated image metadata.

**Persistence note:** Changes made to the XMP XML object are not written back to the image file until `SaveAppFile` is called. For memory workflows, use `SaveToBuffer` to obtain the updated JPG or TIFF bytes.

## Object creation, unlocking and error handling

**Create/Dispose**

```c
HCkXmpW instance = CkXmpW_Create();
// ...
CkXmpW_Dispose(instance);
```

`HCkXmpW CkXmpW_Create(void);`

Creates an instance of the HCkXmpW object and returns a handle ("void \*" pointer). The handle is passed in the 1st argument for the functions listed on this page.

`void CkXmpW_Dispose(HCkXmpW handle);`

Objects created by calling CkXmpW_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function. Also, any handle returned by a Chilkat "C" function must also be freed by the application by calling the appropriate Dispose method, such as CkXmpW_Dispose.

Call `Global.UnlockBundle` once at the start of the program, before using this or any other Chilkat class. Any string unlocks a fully functional 30-day trial; a purchased unlock code is used in production. See `guide.md` for the exact code in Unicode C.

## Members common to every Chilkat class

Documented once per language in `common-members.md`; listed here so this page is self-contained.

| Property | Signature | Access | Meaning |
|---|---|---|---|
| `DebugLogFilePath` | `void CkXmpW_getDebugLogFilePath(HCkXmpW cHandle, HCkString retval); void CkXmpW_putDebugLogFilePath(HCkXmpW cHandle, const wchar_t *newVal); const wchar_t *CkXmpW_debugLogFilePath(HCkXmpW cHandle);` | read/write | If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. |
| `LastErrorHtml` | `void CkXmpW_getLastErrorHtml(HCkXmpW cHandle, HCkString retval); const wchar_t *CkXmpW_lastErrorHtml(HCkXmpW cHandle);` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `void CkXmpW_getLastErrorText(HCkXmpW cHandle, HCkString retval); const wchar_t *CkXmpW_lastErrorText(HCkXmpW cHandle);` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `void CkXmpW_getLastErrorXml(HCkXmpW cHandle, HCkString retval); const wchar_t *CkXmpW_lastErrorXml(HCkXmpW cHandle);` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `BOOL CkXmpW_getLastMethodSuccess(HCkXmpW cHandle); void CkXmpW_putLastMethodSuccess(HCkXmpW cHandle, BOOL newVal);` | read/write | Indicates the success or failure of the most recent method call: `TRUE` means success, `FALSE` means failure. |
| `VerboseLogging` | `BOOL CkXmpW_getVerboseLogging(HCkXmpW cHandle); void CkXmpW_putVerboseLogging(HCkXmpW cHandle, BOOL newVal);` | read/write | If set to `TRUE`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `void CkXmpW_getVersion(HCkXmpW cHandle, HCkString retval); const wchar_t *CkXmpW_version(HCkXmpW cHandle);` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `NumEmbedded` | property, read-only | `int CkXmpW_getNumEmbedded(HCkXmpW cHandle);` |
| `StructInnerDescrip` | property, read/write | `BOOL CkXmpW_getStructInnerDescrip(HCkXmpW cHandle); void CkXmpW_putStructInnerDescrip(HCkXmpW cHandle, BOOL newVal);` |
| `UncommonOptions` | property, read/write | `void CkXmpW_getUncommonOptions(HCkXmpW cHandle, HCkString retval); void CkXmpW_putUncommonOptions(HCkXmpW cHandle, const wchar_t *newVal); const wchar_t *CkXmpW_uncommonOptions(HCkXmpW cHandle);` |
| `AddArray` | method | `BOOL CkXmpW_AddArray(HCkXmpW cHandle, HCkXmlW xml, const wchar_t *arrType, const wchar_t *propName, HCkStringArrayW values);` |
| `AddNsMapping` | method | `void CkXmpW_AddNsMapping(HCkXmpW cHandle, const wchar_t *ns, const wchar_t *uri);` |
| `AddSimpleInt` | method | `BOOL CkXmpW_AddSimpleInt(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *propName, int propVal);` |
| `AddSimpleStr` | method | `BOOL CkXmpW_AddSimpleStr(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *propName, const wchar_t *propVal);` |
| `AddStructProp` | method | `BOOL CkXmpW_AddStructProp(HCkXmpW cHandle, HCkXmlW iChilkatXml, const wchar_t *structName, const wchar_t *propName, const wchar_t *propValue);` |
| `Append` | method | `BOOL CkXmpW_Append(HCkXmpW cHandle, HCkXmlW iXml);` |
| `GetArray` | method | `HCkStringArrayW CkXmpW_GetArray(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *propName);` |
| `GetEmbedded` | method | `HCkXmlW CkXmpW_GetEmbedded(HCkXmpW cHandle, int index);` |
| `GetProperty` | method | `HCkXmlW CkXmpW_GetProperty(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *propName);` |
| `GetSimpleInt` | method | `int CkXmpW_GetSimpleInt(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *propName);` |
| `GetSimpleStr` | method | `BOOL CkXmpW_GetSimpleStr(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *propName, const wchar_t *outStr); const wchar_t *CkXmpW_getSimpleStr(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *propName);` |
| `GetStructPropNames` | method | `HCkStringArrayW CkXmpW_GetStructPropNames(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *structName);` |
| `GetStructValue` | method | `BOOL CkXmpW_GetStructValue(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *structName, const wchar_t *propName, const wchar_t *outStr); const wchar_t *CkXmpW_getStructValue(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *structName, const wchar_t *propName);` |
| `LoadAppFile` | method | `BOOL CkXmpW_LoadAppFile(HCkXmpW cHandle, const wchar_t *filename);` |
| `NewXmp` | method | `HCkXmlW CkXmpW_NewXmp(HCkXmpW cHandle);` |
| `RemoveAllEmbedded` | method | `BOOL CkXmpW_RemoveAllEmbedded(HCkXmpW cHandle);` |
| `RemoveArray` | method | `BOOL CkXmpW_RemoveArray(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *propName);` |
| `RemoveEmbedded` | method | `BOOL CkXmpW_RemoveEmbedded(HCkXmpW cHandle, int index);` |
| `RemoveNsMapping` | method | `void CkXmpW_RemoveNsMapping(HCkXmpW cHandle, const wchar_t *ns);` |
| `RemoveSimple` | method | `BOOL CkXmpW_RemoveSimple(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *propName);` |
| `RemoveStruct` | method | `BOOL CkXmpW_RemoveStruct(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *structName);` |
| `RemoveStructProp` | method | `BOOL CkXmpW_RemoveStructProp(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *structName, const wchar_t *propName);` |
| `SaveAppFile` | method | `BOOL CkXmpW_SaveAppFile(HCkXmpW cHandle, const wchar_t *filename);` |

Deprecated members are listed at the end of this file with their replacements; do not use them in new code.

## Properties

### Xmp.NumEmbedded

`Chilkat 11.7.0 · wc · Xmp · NumEmbedded · property · read-only`

```c
int CkXmpW_getNumEmbedded(HCkXmpW cHandle);
```

The number of XMP metadata documents found within the JPG or TIFF file loaded by LoadAppFile.

### Xmp.StructInnerDescrip

`Chilkat 11.7.0 · wc · Xmp · StructInnerDescrip · property · read/write`

```c
BOOL CkXmpW_getStructInnerDescrip(HCkXmpW cHandle);
void CkXmpW_putStructInnerDescrip(HCkXmpW cHandle, BOOL newVal);
```

Determines whether structures are stored with rdf:parseType=`Resource`, or within an `rdf:Description` sub-node.

### Xmp.UncommonOptions

`Chilkat 11.7.0 · wc · Xmp · UncommonOptions · property · read/write · since 9.5.0.80`

```c
void CkXmpW_getUncommonOptions(HCkXmpW cHandle, HCkString retval);
void CkXmpW_putUncommonOptions(HCkXmpW cHandle, const wchar_t *newVal);
const wchar_t *CkXmpW_uncommonOptions(HCkXmpW cHandle);
```

A property to be used for future uncommon needs. The default value is the empty string.

## Methods

### Xmp.AddArray

`Chilkat 11.7.0 · wc · Xmp · AddArray · method`

```c
BOOL CkXmpW_AddArray(HCkXmpW cHandle, HCkXmlW xml, const wchar_t *arrType, const wchar_t *propName, HCkStringArrayW 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`.

Returns TRUE for success, FALSE for failure.

### Xmp.AddNsMapping

`Chilkat 11.7.0 · wc · Xmp · AddNsMapping · method`

```c
void CkXmpW_AddNsMapping(HCkXmpW cHandle, const wchar_t *ns, const wchar_t *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.

### Xmp.AddSimpleInt

`Chilkat 11.7.0 · wc · Xmp · AddSimpleInt · method`

```c
BOOL CkXmpW_AddSimpleInt(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *propName, int 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`.

Returns TRUE for success, FALSE for failure.

### Xmp.AddSimpleStr

`Chilkat 11.7.0 · wc · Xmp · AddSimpleStr · method`

```c
BOOL CkXmpW_AddSimpleStr(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *propName, const wchar_t *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`.

Returns TRUE for success, FALSE for failure.

### Xmp.AddStructProp

`Chilkat 11.7.0 · wc · Xmp · AddStructProp · method`

```c
BOOL CkXmpW_AddStructProp(HCkXmpW cHandle, HCkXmlW iChilkatXml, const wchar_t *structName, const wchar_t *propName, const wchar_t *propValue);
```

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 TRUE for success, FALSE for failure.

### Xmp.Append

`Chilkat 11.7.0 · wc · Xmp · Append · method`

```c
BOOL CkXmpW_Append(HCkXmpW cHandle, HCkXmlW iXml);
```

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.

Returns TRUE for success, FALSE for failure.

### Xmp.GetArray

`Chilkat 11.7.0 · wc · Xmp · GetArray · method`

```c
HCkStringArrayW CkXmpW_GetArray(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *propName);
```

Finds and returns an XMP array property. The property name should be prefixed with the namespace, such as `dc:subject`.

Returns `NULL` on failure

### Xmp.GetEmbedded

`Chilkat 11.7.0 · wc · Xmp · GetEmbedded · method`

```c
HCkXmlW CkXmpW_GetEmbedded(HCkXmpW cHandle, int index);
```

Returns the Nth embedded XMP document as a Chilkat XML object.

Returns `NULL` on failure

### Xmp.GetProperty

`Chilkat 11.7.0 · wc · Xmp · GetProperty · method`

```c
HCkXmlW CkXmpW_GetProperty(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *propName);
```

To be documented soon...

Returns `NULL` on failure

### Xmp.GetSimpleInt

`Chilkat 11.7.0 · wc · Xmp · GetSimpleInt · method`

```c
int CkXmpW_GetSimpleInt(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *propName);
```

Finds and returns an XMP integer property. The property name should be prefixed with the namespace, such as `tiff:ResolutionUnit`.

### Xmp.GetSimpleStr

`Chilkat 11.7.0 · wc · Xmp · GetSimpleStr · method`

```c
BOOL CkXmpW_GetSimpleStr(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *propName, const wchar_t *outStr);
const wchar_t *CkXmpW_getSimpleStr(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *propName);
```

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.

### Xmp.GetStructPropNames

`Chilkat 11.7.0 · wc · Xmp · GetStructPropNames · method`

```c
HCkStringArrayW CkXmpW_GetStructPropNames(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *structName);
```

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.

Returns `NULL` on failure

### Xmp.GetStructValue

`Chilkat 11.7.0 · wc · Xmp · GetStructValue · method`

```c
BOOL CkXmpW_GetStructValue(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *structName, const wchar_t *propName, const wchar_t *outStr);
const wchar_t *CkXmpW_getStructValue(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *structName, const wchar_t *propName);
```

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.

### Xmp.LoadAppFile

`Chilkat 11.7.0 · wc · Xmp · LoadAppFile · method`

```c
BOOL CkXmpW_LoadAppFile(HCkXmpW cHandle, const wchar_t *filename);
```

Loads a TIFF or JPG file into the XMP object.

Returns TRUE for success, FALSE for failure.

### Xmp.NewXmp

`Chilkat 11.7.0 · wc · Xmp · NewXmp · method`

```c
HCkXmlW CkXmpW_NewXmp(HCkXmpW cHandle);
```

Creates and returns a new/empty XMP metadata document as a Chilkat XML object.

Returns `NULL` on failure

### Xmp.RemoveAllEmbedded

`Chilkat 11.7.0 · wc · Xmp · RemoveAllEmbedded · method`

```c
BOOL CkXmpW_RemoveAllEmbedded(HCkXmpW cHandle);
```

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.

Returns TRUE for success, FALSE for failure.

### Xmp.RemoveArray

`Chilkat 11.7.0 · wc · Xmp · RemoveArray · method`

```c
BOOL CkXmpW_RemoveArray(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *propName);
```

Removes an XMP array property from the XMP document.

Returns TRUE for success, FALSE for failure.

### Xmp.RemoveEmbedded

`Chilkat 11.7.0 · wc · Xmp · RemoveEmbedded · method`

```c
BOOL CkXmpW_RemoveEmbedded(HCkXmpW cHandle, int index);
```

Removes a single XMP metadata document from the JPG or TIFF file. Call SaveAppFile to persist the changes to disk.

Returns TRUE for success, FALSE for failure.

### Xmp.RemoveNsMapping

`Chilkat 11.7.0 · wc · Xmp · RemoveNsMapping · method`

```c
void CkXmpW_RemoveNsMapping(HCkXmpW cHandle, const wchar_t *ns);
```

Removes a namespace-to-URI mapping.

### Xmp.RemoveSimple

`Chilkat 11.7.0 · wc · Xmp · RemoveSimple · method`

```c
BOOL CkXmpW_RemoveSimple(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *propName);
```

Removes a simple XMP property from the XMP document.

Returns TRUE for success, FALSE for failure.

### Xmp.RemoveStruct

`Chilkat 11.7.0 · wc · Xmp · RemoveStruct · method`

```c
BOOL CkXmpW_RemoveStruct(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *structName);
```

Removes an XMP structure property from the XMP document.

Returns TRUE for success, FALSE for failure.

### Xmp.RemoveStructProp

`Chilkat 11.7.0 · wc · Xmp · RemoveStructProp · method`

```c
BOOL CkXmpW_RemoveStructProp(HCkXmpW cHandle, HCkXmlW iXml, const wchar_t *structName, const wchar_t *propName);
```

Removes a single member from an XMP structured property.

Returns TRUE for success, FALSE for failure.

### Xmp.SaveAppFile

`Chilkat 11.7.0 · wc · Xmp · SaveAppFile · method`

```c
BOOL CkXmpW_SaveAppFile(HCkXmpW cHandle, const wchar_t *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.

Returns TRUE for success, FALSE for failure.

## Deprecated members — do not use in new code

| Member | Kind | Deprecated in | Use instead |
|---|---|---|---|
| `LoadFromBuffer` | method | before 11.6.1 | — |
| `SaveToBuffer` | method | before 11.6.1 | — |

## Related classes

[`StringArray`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/wc/classes/StringArray.md), [`Xml`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/wc/classes/Xml.md)

