Platforms to show: All Mac Windows Linux Cross-Platform

Back to CGImageMetadataMBS class.

CGImageMetadataMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 18.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates an empty metadata object.

See also:

CGImageMetadataMBS.Constructor(metadata as CGImageMetadataMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 18.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Copy constructor.

Creates a copy of the metadata.

See also:

CGImageMetadataMBS.CreateXMPData(options as Dictionary = nil) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 18.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Serializes the CGImageMetadataRef to XMP data.

This converts all of the metadata tags to a block of XMP data. Common uses include creating sidecar files that contain metadata for image formats that do not support embedded XMP, or cannot be edited due to other format restrictions (such as proprietary RAW camera formats).

options: should be nil. Options are currently not used, but may be used in future release.

Returns a Memoryblock containing an XMP representation of the metadata. Returns nil if an error occurred.

CGImageMetadataMBS.StringValueWithPath(parent as CGImageMetadataTagMBS = nil, path as String) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 18.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Searches for a specific tag in a CGImageMetadataRef and returns its string value.

This is a convenience method for searching for a tag at path and extracting the string value.

parent: A parent tag. If nil, the path is relative to the root of the metadata (i.e. it is not a child of another property).
path: A string with the path to the desired tag. Please consult the documentation of TagWithPath for information about path syntax.

Returns a string from a CGImageMetadataTagMBS located at 'path'. The tag must be of type kTypeString or kTypeAlternateText.
For AlternateText tags, the element with the "x-default" language qualifier will be returned. For other types, "" will be returned.

CGImageMetadataMBS.TagMatchingImageProperty(dictionaryName as String, propertyName as String) as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 18.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Searches for a specific CGImageMetadataTag matching an image property constant.

Provides a bridge for values from CGImageCopyPropertiesAtIndex, simplifying access for properties defined in EXIF and IPTC standards, which have no notion of namespaces, prefixes, or XMP property types.

Metadata: Working Group guidance is factored into the mapping of CGImage properties to XMP compatible metadata tags.

For example, kCGImagePropertyExifDateTimeOriginal will get the value of the corresponding XMP tag, which is photoshop:DateCreated. Note that property values will still be in their XMP forms, such as "YYYY-MM-DDThh:mm:ss" for DateTime, rather than the EXIF or IPTC DateTime formats.

dictionaryName: the metadata subdictionary to which the image property belongs, such as kCGImagePropertyExifDictionary or kCGImagePropertyIPTCDictionary. Not all dictionaries and properties are supported at this time.
propertyName: the name of the property. This must be a defined property constant corresponding to the 'dictionaryName'. For example, kCGImagePropertyTIFFOrientation, kCGImagePropertyExifDateTimeOriginal, or kCGImagePropertyIPTCKeywords. A warning will be logged if the CGImageProperty is unsupported by CGImageMetadata.

Returns a CGImageMetadataTagRef with the appropriate namespace, prefix, tag name, and XMP value for the corresponding CGImageProperty. Returns nil if the property could not be found.

CGImageMetadataMBS.Tags as CGImageMetadataTagMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 18.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Obtain an array of tags from a metadata object.

See also:

CGImageMetadataMBS.Tags(rootPath as string, options as Dictionary = nil) as CGImageMetadataTagMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 18.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the tags matching the path and options.

This function iterates over all of the tags in a metadata to collect the matching one. The default behavior iterates over all top-level tags in the metadata.

rootPath: Iteration will occur for all children of the tag matching the root path. Please refer to TagWithPath for information about path syntax. If an empty string, the search will be executed for all top-level tags in the metadata container.
options: A dictionary of options for iterating through the tags.
Currently the only supported option is kCGImageMetadataEnumerateRecursively, which should be set to a boolean.

Returns array with found items.

See also:

CGImageMetadataMBS.TagWithPath(parent as CGImageMetadataTagMBS = nil, path as string) as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 18.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Searches for a specific CGImageMetadataTagMBS in a CGImageMetadataMBS.

This is the primary function for clients to obtain specific metadata properties from an image. The 'path' mechanism provides a way to access both simple top-level properties, such as Date & Time, or complex deeply-nested properties with ease.

parent: A parent tag. If nil, the path is relative to the root of the metadata (i.e. it is not a child of another property). If the parent is provided, the effective path will be the concatenation of the parent's path and the 'path' parameter. This is useful for accessing array elements or structure fields inside nested tags.

path: A string representing a path to the desired tag. Paths consist of a tag prefix (i.e. "exif") joined with a tag name (i.e. "Flash") by a colon (":"), such as "exif:Flash".
Elements of ordered and unordered arrays are accessed via 0-based indices inside square [] brackets.
Elements of alternate-text arrays are accessed by an RFC 3066 language code inside square [] brackets.
Fields of a structure are delimited by a period, '.'.
Qualifiers are delimited by the '?' character. Only tags with string values (kTypeString) are allowed to have qualifiers - arrays and structures may not contain qualifiers.

If parent is nil, a prefix must be specified for the first tag. Prefixes for all subsequent tags are optional. If unspecified, the prefix is inherented from the nearest parent tag with a prefix. Custom prefixes must be registered using RegisterNamespaceForPrefix prior to use in any path-based functions.

Examples:

  • 'path' = "xmp:CreateDate"
  • 'path' = "exif:Flash.Fired"
  • 'parent' = tag at path "exif:Flash", path = "exif:Fired" (equivilent to previous)
  • 'path' = "exif:Flash.RedEyeMode"
  • 'path' = "dc:title"
  • 'path' = "dc:subject"
  • 'path' = "dc:subject[2]"
  • 'parent' = tag at path "dc:subject", path = "[2]" (equivilent to previous
  • 'path' = "dc:description[x-default]
  • 'path' = "dc.description[de]
  • 'path' = "dc.description[fr]
  • 'path' = "foo:product
  • 'path' = "foo:product?bar:manufacturer

Returns a CGImageMetadataTagMBS matching 'path', or nil if no match is found. The copy of the tag's value is shallow. Tags copied from an immutable CGImageMetadataMBS are also immutable. Because this function returns a copy of the tag's value, any modification of the tag's value must be followed by a SetTagWithPath to commit the change to the metadata container.

The items on this page are in the following plugins: MBS MacCG Plugin.


The biggest plugin in space...