Winforms - automated retrieve static image
-
Hello All, I haven't coded a lot in Winforms C#. In any case I need to fetch a temporary stored image image from the local disk and process in a vendors API. Their method requires Bitmap bitmap for the parameters as indicated here(//vendor.Reader.AnalyzeField(Bitmap bitmap)). // Example 1 - This works when I use hard coded texted. // Example 2 fails attempting to use with the variable. The error is "Parameter is not valid". 1 - Bitmap btm = new Bitmap "C:\\Images\\2.tif"); // The variable fails here. 2 - Bitmap btm = new Bitmap(_transferFile); //Perform recognition result = vendor.Reader.AnalyzeField(btm); Thanks in advance
-
Hello All, I haven't coded a lot in Winforms C#. In any case I need to fetch a temporary stored image image from the local disk and process in a vendors API. Their method requires Bitmap bitmap for the parameters as indicated here(//vendor.Reader.AnalyzeField(Bitmap bitmap)). // Example 1 - This works when I use hard coded texted. // Example 2 fails attempting to use with the variable. The error is "Parameter is not valid". 1 - Bitmap btm = new Bitmap "C:\\Images\\2.tif"); // The variable fails here. 2 - Bitmap btm = new Bitmap(_transferFile); //Perform recognition result = vendor.Reader.AnalyzeField(btm); Thanks in advance
fincity wrote:
The error is "Parameter is not valid".
Then you need to use a parameter that is valid, i.e. a
Bitmap
as specified in the method definition. You have not specified what type_transferFile
is, but I assume it is not aBitmap
.Use the best guess
-
Hello All, I haven't coded a lot in Winforms C#. In any case I need to fetch a temporary stored image image from the local disk and process in a vendors API. Their method requires Bitmap bitmap for the parameters as indicated here(//vendor.Reader.AnalyzeField(Bitmap bitmap)). // Example 1 - This works when I use hard coded texted. // Example 2 fails attempting to use with the variable. The error is "Parameter is not valid". 1 - Bitmap btm = new Bitmap "C:\\Images\\2.tif"); // The variable fails here. 2 - Bitmap btm = new Bitmap(_transferFile); //Perform recognition result = vendor.Reader.AnalyzeField(btm); Thanks in advance
You mean something similar to below code?
string fileName = "C:\\Images\\2.tif";
Bitmap btm = new Bitmap(fileName);//Perform recognition
result = vendor.Reader.AnalyzeField(btm);Where is the initialization-code of your _transferFile member?
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]