using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
// Create a template "A".
int imageID = gdpictureImaging.CreateGdPictureImageFromFile(@"templateA.jpg");
int firstTemplateID = gdpictureImaging.ADRCreateTemplateFromGdPictureImage(imageID);
gdpictureImaging.ADRSetTemplateTag(firstTemplateID, "TemplateA");
gdpictureImaging.ReleaseGdPictureImage(imageID);
// Create a template "B".
imageID = gdpictureImaging.CreateGdPictureImageFromFile(@"templateB.jpg");
int secondTemplateID = gdpictureImaging.ADRCreateTemplateFromGdPictureImage(imageID);
gdpictureImaging.ADRSetTemplateTag(secondTemplateID, "TemplateB");
gdpictureImaging.ReleaseGdPictureImage(imageID);
// Identify the template which has the best similar content.
imageID = gdpictureImaging.CreateGdPictureImageFromFile(@"image.jpg");
int templateID = gdpictureImaging.ADRGetCloserTemplateForGdPictureImage(imageID);
gdpictureImaging.ReleaseGdPictureImage(imageID);
string templateName = gdpictureImaging.ADRGetTemplateTag(templateID);
MessageBox.Show(templateName, "ADRGetCloserTemplateForGdPictureImage", MessageBoxButtons.OK, MessageBoxIcon.Information);
// Deletes all document identifier templates.
gdpictureImaging.ADRDeleteTemplate(firstTemplateID);
gdpictureImaging.ADRDeleteTemplate(secondTemplateID);
}