GdPicture.NET Reference Guide
ADRCreateTemplateFromFile Method (GdPictureImaging)
Example 





GdPicture14 Namespace > GdPictureImaging Class : ADRCreateTemplateFromFile Method
The path of the image from which the new template will be created. Can be an empty string. If empty, prompts the user to select a file. You can subsequently use the GetLastPath() method to retrieve the path of the selected file.
Creates a new Document Identifier Template from an image file.
Syntax
'Declaration
 
Public Function ADRCreateTemplateFromFile( _
   ByVal FilePath As String _
) As Integer
public int ADRCreateTemplateFromFile( 
   string FilePath
)
public function ADRCreateTemplateFromFile( 
    FilePath: String
): Integer; 
public function ADRCreateTemplateFromFile( 
   FilePath : String
) : int;
public: int ADRCreateTemplateFromFile( 
   string* FilePath
) 
public:
int ADRCreateTemplateFromFile( 
   String^ FilePath
) 

Parameters

FilePath
The path of the image from which the new template will be created. Can be an empty string. If empty, prompts the user to select a file. You can subsequently use the GetLastPath() method to retrieve the path of the selected file.

Return Value

The created template ID if success else, -1 if fail. check the GetStat() method to get the reason on this result.
Example
How to create document templates and identify the one which has the closest similar content to an image file.
Dim TemplateID1 As Integer, TemplateID2 As Integer
Dim nCloserTemplate As Integer
'We create the first template from an image
TemplateID1 = oGdPictureImaging.ADRCreateTemplateFromFile("template1.tif")
If TemplateID1 = 0 Then
   MessageBox.show("Can't create TemplateID1 " + "Error number: " + Str(oGdPictureImaging.GetStat))
End If
'We create the second template from an other kind of image
TemplateID2 = oGdPictureImaging.ADRCreateTemplateFromFile("template2.tif")
If TemplateID2 = 0 Then
   MessageBox.show("Can't create TemplateID2 " + "Error number: " + Str(oGdPictureImaging.GetStat))
End If
'Now, we will try to identify an image.
nCloserTemplate = oGdPictureImaging.ADRGetCloserTemplateForFile("document.tif")
Select Case nCloserTemplate
Case TemplateID1
MessageBox.show("This image seems to get best similar content as TemplateID1. Confidence is: " + Str(oGdPictureImaging.ADRGetLastConfidence) + " %")
Case TemplateID2
MessageBox.show("This image seems to get best similar content as TemplateID2. Confidence is: " + Str(oGdPictureImaging.ADRGetLastConfidence) + " %")
End Select
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members