You are here: User Guide > Nuke > Working with File Metadata > Accessing Metadata via TCL Expressions

Accessing Metadata via TCL Expressions

You can access metadata via TCL expressions in the following ways:

To get a list of all keys in the incoming metadata, use the expression [metadata]. For example, if you add a Text node after an image and enter [metadata] in the message field, a list of all the keys in the incoming metadata appears on the image. The values of the keys are not displayed.

To get the value of a particular key in the incoming metadata, use the expression [metadata key]. Replace key with the name of the key whose value you want to use. For example, to display the name and location of the image file on the image, add a Text node after the image and enter [metadata input/filename] in the message field.

To get a filtered list of keys in the incoming metadata, use the expression [metadata keys filter]. Replace filter with whatever you want to use to filter the list. You can use asterisks (*) as wildcards in your filter to substitute zero or more characters in the key names. For example, to get a list of all the keys with the letter f in them, use the expression [metadata keys *f*]. To get a list of all the keys starting with input/, use the expression [metadata keys input/*].

By default, the keys are listed on separate lines. To change this, you can use -s "separator" to have the keys separated by a separator of your choice. Replace separator with whatever you want to appear between the different keys. For example, to get a list of all the keys starting with input/ and separated by spaces, you can use [metadata -s " " keys input/*]. To get the same list separated by commas, use [metadata -s ", " keys input/*].

By default, if you attempt to access metadata that does not exist in the stream, Nuke returns an empty string. To make this error instead, use the -e flag before other parameters.

For more information on using expressions, see the Expressions chapter in the Nuke User Guide.