GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / ADRCreateTemplateFromGdPictureImage Method
GdPicture image identifier. The image from which the new template will be created.
Example





In This Topic
ADRCreateTemplateFromGdPictureImage Method (GdPictureImaging)
In This Topic
Creates a new Document Identifier Template from a GdPicture image.
Syntax
'Declaration
 
Public Function ADRCreateTemplateFromGdPictureImage( _
   ByVal ImageID As Integer _
) As Integer
public int ADRCreateTemplateFromGdPictureImage( 
   int ImageID
)
public function ADRCreateTemplateFromGdPictureImage( 
    ImageID: Integer
): Integer; 
public function ADRCreateTemplateFromGdPictureImage( 
   ImageID : int
) : int;
public: int ADRCreateTemplateFromGdPictureImage( 
   int ImageID
) 
public:
int ADRCreateTemplateFromGdPictureImage( 
   int ImageID
) 

Parameters

ImageID
GdPicture image identifier. The image from which the new template will be created.

Return Value

The created template ID if success else, -1 if fail. check the GetStat() method to get the reason on this result.
Example
Creating two templates and display the name of the template which has the best similar content to an image file.
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);
}
See Also