Hi,
I often need detect barcode from many TIF files one time,
it will take a moment to finish the whole process (e.g. 100 tif files will use 220 seconds),
is there any method to improve it to use less time?
We only let the barcode locates at the top of the tif (e.g. only use 1/5 high of the file), can i only read part area to stream?
Thanks.
--code snippet, license for 3.7.0.0 version
private void btnBatchDetectBarcode_Click(object sender, EventArgs e)
{
DateTime time1 = DateTime.Now;
StringBuilder sb = new StringBuilder();
string[] files = Directory.GetFiles(Application.StartupPath + "\\tif");
foreach (string tifFile in files)
{
if (!tifFile.ToLower().EndsWith(".tif"))
{
continue;
}
BarCodeReader reader;
reader = new BarCodeReader(tifFile, BarCodeReadType.Code39Standard | BarCodeReadType.Code39Extended);
while (reader.Read())
{
string type = reader.GetReadType().ToString();
string val = reader.GetCodeText();
sb.Append(type + " / " + val + "\r\n");
break;
}
reader.Close();
}
DateTime time2 = DateTime.Now;
TimeSpan ts = time2 - time1;
sb.Insert(0, "Used seconds: " + ts.TotalSeconds + "\r\n\r\n");
this.textBox1.Text = sb.ToString();
}