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

# CGImageMetadataCopyTagWithPath(_:_:_:)

Searches for a specific metadata tag within a metadata collection.

```
func CGImageMetadataCopyTagWithPath(_ metadata: CGImageMetadata, _ parent: CGImageMetadataTag?, _ path: CFString) -> CGImageMetadataTag?
```

## Parameters

`metadata`

The metadata object that contains the tags.

`parent`

The parent tag, if any. Specify `NULL` to start the search in the top-level tags of the metadata object. If this parameter is `NULL`, you must include a valid prefix string in the `path` parameter.

`path`

A string that represents the path to the tag. A path consists of the tag’s name, plus optional prefix and parent information. Separate prefix information from other path information using a colon (`:`) character. Separate parent and child tags using the period (`.`) character. For example, the string `“exif:Flash.RedEyeMode”` represents the path to the `RedEyeMode` field of the `Flash` parent structure in the EXIF metadata.

    When a tag contains an ordered or unordered array, specify elements using a     `0`    -based index inside square brackets. For example, use the string     `“dc.subject[2]”`     to access the third element in the     `subject`     array.

    When the tag contains an alternate-text array, access elements using an RFC 3066 language code inside square brackets. For example, use the string     `“dc.description[de]”`     to access the German description information.

    Use the ? character to delimit qualifiers for tags with string values. You may not use this character for arrays and structures.

## Return Value

A copy of the [`CGImageMetadataTag`](/documentation/ImageIO/CGImageMetadataTag) object at the specified path, or `NULL` if the tag wasn’t found.

## Discussion

If you specify a valid tag in the `parent` parameter, you may omit the parent’s path information from the `path` parameter. For example, to access the `RedEyeMode` field, specify the [`CGImageMetadataTag`](/documentation/ImageIO/CGImageMetadataTag) object for the `Flash` parent property, and specify `“RedEyeMode”` for the path string.

If a tag contains a custom prefix that is not already present in the metadata object, call [`CGImageMetadataRegisterNamespaceForPrefix(_:_:_:_:)`](/documentation/ImageIO/CGImageMetadataRegisterNamespaceForPrefix(_:_:_:_:)) to register that prefix before you search for it with this function.

---

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)