---
title: "CGImageMetadataTagCreate(_:_:_:_:_:)"
framework: imageio
role: symbol
role_heading: Function
path: "imageio/cgimagemetadatatagcreate(_:_:_:_:_:)"
---

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

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

## Declaration

```swift
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 doc://com.apple.imageio/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 doc://com.apple.imageio/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 doc://com.apple.imageio/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 doc://com.apple.imageio/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 doc://com.apple.imageio/documentation/ImageIO/CGImageMetadataTag.

## Return Value

Return Value A new CGImageMetadataTag type, or NULL if an error occurred.
