<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.8.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ImageIO",
  "identifier" : "/documentation/ImageIO/CGImageMetadataCreateXMPData(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Image I/O"
    ],
    "preciseIdentifier" : "c:@F@CGImageMetadataCreateXMPData"
  },
  "title" : "CGImageMetadataCreateXMPData(_:_:)"
}
-->

# CGImageMetadataCreateXMPData(_:_:)

Returns a data object that contains the metadata object’s contents serialized into the XMP format.

```
func CGImageMetadataCreateXMPData(_ metadata: CGImageMetadata, _ options: CFDictionary?) -> CFData?
```

## Parameters

`metadata`

The metadata object to serialize. The function converts all tags in this object to XMP data.

`options`

Additional options for the serialization process. Options aren’t currently supported, so specify `NULL`.

## Return Value

A <doc://com.apple.documentation/documentation/CoreFoundation/CFData> object with an XMP representation of the metadata, or `NULL` if an error occurs.

## Discussion

Use this function to create sidecar files with metadata for image formats that don’t support embedded XMP, or that you cannot edit due to other format restrictions. For example, use this function to create the data for proprietary RAW camera formats.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)