<!--
{
  "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/CGImageMetadataTagCreate(_:_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Image I/O"
    ],
    "preciseIdentifier" : "c:@F@CGImageMetadataTagCreate"
  },
  "title" : "CGImageMetadataTagCreate(_:_:_:_:_:)"
}
-->

# CGImageMetadataTagCreate(_:_:_:_:_:)

Creates a new image metadata tag, and fills it with the specified information.

```
func CGImageMetadataTagCreate(_ xmlns: CFString, _ prefix: CFString?, _ name: CFString, _ type: CGImageMetadataType, _ value: CFTypeRef) -> CGImageMetadataTag?
```

## Parameters

`xmlns`

The namespace for the tag. Specify a common XMP namespace, such as [`kCGImageMetadataNamespaceExif`](/documentation/ImageIO/kCGImageMetadataNamespaceExif), or a string with a custom namespace URI. A custom namespace must be a valid XML namespace. By convention, namespaces end with either the `/` or `#` character.

`prefix`

An abbreviation for the XML namespace. You must specify a valid string for custom namespace. For standard namespaces such as [`kCGImageMetadataNamespaceExif`](/documentation/ImageIO/kCGImageMetadataNamespaceExif), you may specify `NULL`.

`name`

The name of the metadata tag. This string must correspond to a valid XMP name.

`type`

The type of data in the `value` parameter. For a list of possible values, see [`CGImageMetadataType`](/documentation/ImageIO/CGImageMetadataType).

`value`

The value of the tag. The value’s type must match the information in the `type` parameter. Supported types for this parameter are <doc://com.apple.documentation/documentation/CoreFoundation/CFString>, <doc://com.apple.documentation/documentation/CoreFoundation/CFNumber>, <doc://com.apple.documentation/documentation/CoreFoundation/CFBoolean>, <doc://com.apple.documentation/documentation/CoreFoundation/CFArray>, and <doc://com.apple.documentation/documentation/CoreFoundation/CFDictionary>. The keys of a dictionary must be <doc://com.apple.documentation/documentation/CoreFoundation/CFString> types with XMP names. The values of a dictionary must be either <doc://com.apple.documentation/documentation/CoreFoundation/CFString> or [`CGImageMetadataTag`](/documentation/ImageIO/CGImageMetadataTag) types.

    The newly created tag stores only a shallow copy of the original value. As a result, modifying the original value doesn’t affect the value in the new [`CGImageMetadataTag`](/documentation/ImageIO/CGImageMetadataTag)    .

## Return Value

A new [`CGImageMetadataTag`](/documentation/ImageIO/CGImageMetadataTag) type, or `NULL` if an error occurred.

---

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)