Metadata Templates

Metadata Templates are a time-saver feature.

They enable you to quickly fill in pre-defined metadata into individual or sets of files, change collection assignments or ratings and labels for single or hundreds of files at once. IMatch can apply metadata templates on file import, which enables you to fill in your photographer or studio info automatically when you add images to your database.

To manage your metadata templates, go to Edit > Preferences > Metadata Templates. Or click the corresponding button in the Metadata Panel toolbar.

The left side of the dialog shows the current set of templates. Here you can create, clone, rename and delete templates. To see the settings for a template, select it in this list.

The sample template in the screen shot sets the Copyright tag from the text in the lower edit field.
We use the variable {File.DateTime|format:YYYY} to insert the current year. The output looks like: this:

Copyright 2023 ** Your name here **

and thanks to the variable, the year will automatically adjust to the year the image was created whenever the template is applied. Replace the placeholder ** Your name here ** with your name and you have a working template.

If you want to set the current date when you apply the metadata template to a file, you could use the following variable instead:

{Application.DateTime|format:YYYY} ** Your Name Here**

Applying Templates

Metadata Templates are applied to all files selected in the file window. This allows you to add frequent data like copyright info etc. to one, a dozen or even hundreds of files with a few keystrokes.

There are several ways to apply a metadata template.

Menu

To apply a template to one or more files selected in a file window, go to Tools > Metadata Templates and choose the template to apply.

You can assign a hotkey to your template for the Tools > Metadata Templates menu by using an ampersand '&' character in the template name.

For example, if you name a template "Clear &Flags", the template will be accessible via the hotkey F in the menu. The hotkey will be indicated with an underscore, like this: F when you open the menu using the keyboard.

The menu shows up to 30 metadata templates, alphabetically sorted by name.

If you need more than 30 templates, use Favorites to manage and run then. Favorites can manage any number of templates, and you can run them with a single mouse-click or keyboard shortcut.

Metadata Panel

You can also apply and edit metadata templates directly from within the Metadata Panel.

Favorites

You can also create Favorites from your metadata template. This makes them available with a single mouse click. To create a Favorite, right-click in the Favorites panel while a user tab is active:

Applying Metadata Templates During File Import

You can automatically apply metadata templates when new files are added to your database. This allows you, for example, to automatically fill in standard data like copyright info, stock keywords or legal copy when files are imported. This can be a big time saver, especially when you work on tight deadlines, or you need to add the same info to each image anyway.

See Edit > Preferences > Indexing for more information.

Working with Collections

Below the list, the dialog displays controls for each manual collection. Depending on the collection, different values are available in the drop-down list. If you set the drop-down list to No Change the metadata template does not change the corresponding collection.

Use these controls if you want to create a metadata template which sets or resets one or more collections.

See Collections for more information about collections.

Locations

You can use these options to assign a specific Location to all files to which the template is applied. This will set the GPS data of the file from the data recorded in the location, and also set fields like Country, Street, ZIP etc. from the location. This works whether the file already has GPS coordinates or not.

If you set this to Automatic mode, IMatch picks the best matching (nearest) location, using the GPS coordinates recorded in the file. In this mode, only files with GPS coordinates are considered. If you want to replace the existing GPS coordinates in the file with the GPS coordinates of the best matching location, enable the Assign GPS coordinates of location option. This allows you to equalize the coordinates of all files within the radius spanned by a location.

Locations Workflow

This feature allows you to geo-code files quickly, and to assign location data based on a location you have created earlier in the Map panel. No remote reverse geocoding service is needed (works also when you are off-line) and you control precisely which data is added to the files by what you enter into the location in the Map panel.

This is how it works:

If the Location has the snap option enabled, the GPS coordinates of the file will also be changed to the coordinates of the location. This overrides the Assign GPS coordinates of location option in this dialog.

See the Locations and Map Panel topics for more information.

Adding, Editing and Deleting Metadata

Filling in or modifying metadata is the main purpose of metadata templates. This feature allows you to add one or more values for one or more tags. You can also replace or delete existing metadata.

Use this to fill in standard metadata like your copyright statement and usage rights statement, photographer and agency info. Or to copy metadata from one tag to another, see below.

In the upper list, you add the tags for which you want to add data. You select the tags from the standard Tag Selector dialog by clicking the Add button. You can process any number of tags in a single metadata template.

In the lower edit field, you enter the data which should be written to the tag currently selected in the upper list. The edit field accepts a free combination of literal text and IMatch variables to specify what should be written into the selected tag selected. Click on the Var button to open the standard Variable selector dialog box.

The Metadata Mechanic app can be used to clean metadata or fix specific metadata problems. It supports both raw and formatted tag values and is designed to be used interactively. Metadata Templates are designed to be used automatically during indexing or in the Metadata Panel.

Utilizing the Power of Variables

You can use variable formatting functions to convert and prepare the source data. This enables you clean-up data before it is written into the target tag.

If you use the same tag for the target and source, you can extend or modify tag values on-the-fly. Variables enable you to combine values of different tags or fill tags conditionally, e.g. by using the hasvalue variable formatting function.

Deleting Metadata

To delete existing data for a tag, add the tag to the list and then check the Delete existing contents option at the bottom. The tag will be removed from the target file.

Repeatable Tags

Some metadata tags can hold more than one value. For example, a file can have any number of hierarchical keywords. To enter multiple values for such tags, separate the values with a semicolon (;) in the edit box. If the target tag already has a value, it will not be added again.

For repeatable tags you usually want to set the Merge with existing contents option. Otherwise all existing values will be replaced with the new data.

Working With Raw Tag Values

IMatch and ExifTool maintain one or two values for tags. Most tags only have one value, to so-called formatted value. Numerical tags like aperture, shutter speed or GPS coordinates (lat/lon/alt) have a raw value (the numerical value) and a formatted value, which ExifTool produces from the numerical value.

For example, the shutter speed tag is stored in the image as a numerical value like 0.00625 and the formatted value IMatch shows for it is 1/160. For GPS coordinates, the longitude might be stored as 8.525201 in the file, but IMatch can show it as 8 deg 31' 30.72" e.g. in the Metadata Panel or File Window.

See Using Raw Values for more information.

If you want to assign GPS coordinates in your Metadata Template directly, make sure to enable the Use raw value option and provide the coordinates in their decimal form. Setting the formatted value for GPS coordinates will do nothing since IMatch internally uses the numerical value only.

Use XMP::exif\GPSLatitude\GPSLatitude and XMP::exif\GPSLongitude\GPSLongitude when setting GPS coordinates directly in a Metadata Template. This ensures that the coordinates are properly propagated into linked tags in other metadata formats.

You can set GPS coordinates and location data like Country and City comfortably using IMatch Locations, the Map Panel or AutoFill.

Using Variables

The ability to use IMatch variables to define the values for metadata tags opens up a wide range of applications. In the screen shot above we see the following value:

Copyright © {File.DateTime|format:YYYY} Mario M. Westphal.

The variable {File.DateTime} represents the date and time the image was created. The format format:YYYY returns the year of the date, so the image was created in 2020, the following value will be written to the metadata: Copyright © 2020 Mario M. Westphal.

The {File.DateTime} variable represents the timestamp IMatch has determined for the image. For images this is usually the EXIF date subject created timestamp. See How IMatch uses Date and Time Information for more information.

Copying IMatch Categories into Keywords

A fairly common task for metadata templates is to copy selected categories into hierarchical keywords. Especially for users who favor categories over keywords, but sometimes need to push the categories into keywords when delivering or uploading a file. Or users who want to migrate some of their categories into hierarchical keywords for interoperability purposes.

To copy selected categories (you usually don't want to copy all categories, especially not @Keyword categories!) you combine a categories variable with the filter variable function. An example:

{File.Categories|filter:(^Cities|^Motive)}

The File.Categories variable returns all categories assigned to a file as a semicolon-separated list. With the filter function we access the regular expression power of IMatch: (^Cities|^Motive) filters out all categories which don't start with either Cities or Motive. The resulting keyword will contain terms like Cities|London or Motive|Landscape, but not @Keywords|Food|Fruit or Friends|Peter.

Copying Data Between Metadata Tags

The ability to use variables to specify the data to fill into the selected tag opens a wide range of applications. You can use them to copy metadata from one tag to another, or to fill tags from other tags.

For example, some agencies request that the camera make and model name have to be written as keywords in the file. This can be easily achieved with a value like this:

{File.MD.Exif::Main\271\Make}/{File.MD.Exif::Main\272\Model}

Add the hierarchical keywords tag in the upper list and fill it using the variable expression above. Make sure to enable the option to merge with existing contents. If you now apply the template, IMatch retrieves the camera maker and camera model name from the metadata and adds the combined information as a new keyword to the hierarchical keywords tag. If the keyword already exists, it is not added again.

When you copy metadata between tags, make sure you are using the correct format. More info on this below.

Appending and Inserting Data

Since you can use variables to control the data you write to the output tag, you can do cool things. For example, if you want to insert new data in front of existing data or modify existing data in some way .

The following variable inserts the camera make and model in front of the data already existing in the headline tag:

{File.MD.Exif::Main\271\Make\0}{File.MD.Exif::Main\272\Model\0} {File.MD.XMP::photoshop\Headline\Headline\0}

The trick is that you use the variable corresponding to the output tag (headline) also in the source expression. This gives you flexibility in where you insert new data.

You can use the same trick when you want to modify existing data. For example, if you want to convert the copyright notice into upper-case, you select the Copyright notice as the target tag, and fill it from the variable corresponding to the copyright notice as follows:

{File.MD.XMP::dc\rights\Rights\0|to_upper}

This variable fetches the contents of the copyright notice and converts it to upper case.

Repeatable Tags and Variables

Do not use ; when you work with variables (e.g. to produce multiple keywords). This will not work because the ; is part of variable formatting functions. If you want to produce two keywords from the make and the model tags used in the previous example, use an  expression like:

{File.MD.Exif::Main\271\Make|postfix:~;}{File.MD.Exif::Main\272\Model}

The same two variables as before, but the first one uses a postfix to write a ; to the output. The result looks something like this:

NIKON CORPORATION;NIKON D4

The ; between the brand name and the model name will be detected by the metadata template. It will split the value at the ; and produce two separate keywords from the result.

Use Conditional Replacements

Sometimes you may want to retain the existing tag value unless the tag has a specific value. Or you want to replace a specific value but keep other values. In these situations, you use a variable to check for the condition and then return either the new value or the exiting value.

Let's say you want to set the rating to 3, but only if the rating is currently 0. You use the {XMP::xmp\Rating} tag as the target, and this variable to fill it:

{File.MD.rating|cast:int;numcomp:eq,0,3,{File.MD.rating|cast:int}}

This variable uses numcomp to check if the file has a rating of 0 and if this is the case, it returns 3 else it returns the existing rating.

The cast:int function ensures that the rating does not use decimals (1.00 becomes 1). See Casting Variables for more information.

Options

The options at the bottom allow you to control how the template deals with existing data. These options are global and work for all tags in the currently active template.

Insert only if emptyIf this is enabled, the tag will only receive contents if it is empty or does not exist in the target file.
Merge with existing contentsUse this option to append new data to existing data in the tag. You should enable this for repeatable tags like keywords and other array-type tags if you want to append the values in the template to the existing set of keywords or other values.

If you set this option for a non-repeatable tag (e.g. Title), IMatch appends the contents of the edit field to the Title already in the file.
Delete existing contentsDeletes existing data from the tag. This is a useful option if you want to erase certain elements from the metadata.

Use the Correct Format

ExifTool expects certain formats for tags of certain types, e.g. date and time tags. When you use variables to update such tags, you have to make sure that you produce the expected format.

For example, ExifTool expects the following format for a date/time tag:

YYYY:MM:DD hh:mm:ss{optional:time zone +/- hh:mm or Z}

Or, with the optional time zone:

YYYY:MM:DD hh:mm:ss +/-HH:MM

For example: 2021:12:01 12:00:00 or 2021:12:01 12:00:00 +01:00.

To ensure this format, you have to use the following format function for variables:

format:YYYY:MM:DD hh:mm:ss

For example: {File.DateTime|format:YYYY:MM:DD hh:mm:ss}

Alternatively, you can use the value:formatted variable function to directly access the tag data as formatted by ExifTool:

{File.MD.XMP::photoshop\DateCreated\DateCreated\0|value:formatted}

This returns the tag data in the format required by ExifTool, e.g. 2021:08:07 09:42:55+04:00.

Location Data

If you want to set location data like country or city, we recommend you use these target tags:

Country-Code: {File.MD.XMP::iptcCore\CountryCode\CountryCode\0}
Country: {File.MD.Composite\MWG-Country\Country\0}
State: {File.MD.Composite\MWG-State\State\0}
City: {File.MD.Composite\MWG-City\City\0}
Location: {File.MD.Composite\MWG-Location\Location\0}

Using the special MWG Composite tags ensures that ExifTool also updates the associated tags in XMP IPTC and XMP IPTCExt. IMatch uses these tags internally, e.g. when you perform reverse geocoding or work with IMatch Locations.

Exporting and Importing Templates

With the Export button you can export all templates into a file on disk. This allows you to share your metadata templates with other users.

To import templates from a disk file, click on Import.

If you want to import only some of your templates, delete the other templates temporarily in the Metadata Templates dialog. Then export the remaining templates. Close the Metadata Templates dialog with Cancel to prevent IMatch from saving your changes. This way all deleted templates will be back.

The Metadata Mechanic

Metadata Templates are great for filling standard tags like copyright notices, legal text, author info, locations and more. You can also use them to modify or change existing metadata.

For more complex cases and more functionality geared towards dealing with complex metadata repairs or modifications, the Metadata Mechanic app included in IMatch is al alternative.