image.png (14.2 KB)
I’m using Aspose.BarCode version 25.6.0.0 to read barcodes from TIFF files. I’ve noticed that the same TIFF file produces different barcode reading results depending on the device:
- On a mobile phone using a barcode reader app, the barcode is read quickly and accurately.
- On a desktop application using Aspose.BarCode, the reading takes longer or sometimes fails.
Could you help me understand what might be causing this discrepancy? Are there any settings or optimizations in Aspose.BarCode that could improve consistency across devices?
@jithus.tvr
The discrepancy you’re experiencing with barcode reading results from TIFF files on different devices can be attributed to several factors. Here are some potential causes and solutions to consider:
-
Image Quality: Ensure that the TIFF files are of high quality. Low-resolution images can lead to poor recognition results. Check the DPI (dots per inch) settings of the TIFF files to ensure they are adequate for barcode scanning.
-
Barcode Settings: The Aspose.BarCode library allows you to configure various settings that can affect recognition. Adjust the QualitySettings to optimize for speed or accuracy. For example, using QualitySettings.getHighPerformance() can improve reading speed, while QualitySettings.getHighQuality() can enhance accuracy.
-
Timeout Settings: If the reading process is taking too long, adjust the timeout settings. Set a timeout for the recognition process to ensure it doesn’t hang indefinitely.
-
Multi-threading: If your desktop application supports it, enable multi-threading for barcode recognition. This can significantly speed up the reading process, especially for larger images.
-
Barcode Types: Ensure you are specifying the correct barcode types when initializing the BarCodeReader. If uncertain, use a broader set of types to increase the chances of successful recognition.
Here’s a minimal code example to illustrate how to set some of these options:
BarCodeReader reader = new BarCodeReader("path/to/your/image.tiff", DecodeType.CODE_39, DecodeType.CODE_128);
reader.setQualitySettings(QualitySettings.getHighPerformance());
reader.setTimeout(5000); // Set timeout to 5 seconds
for (BarCodeResult result : reader.readBarCodes()) {
System.out.println("BarCode Type: " + result.getCodeTypeName());
System.out.println("BarCode CodeText: " + result.getCodeText());
}
By implementing these adjustments, you should see improved consistency in barcode reading results across different devices. Please proceed with these recommendations and let me know if you need further assistance or if the issue persists!
am using .net code the issue not only for multiple device also , not reading all barcodes properly
using (BarCodeReader reader = new BarCodeReader(txtFileName.Text))
{
DateTime start = DateTime.Now;
if (chkHighPerformance.Checked)
reader.QualitySettings = QualitySettings.HighPerformance;
listBox1.Items.Clear();
StringBuilder barcodeData = new StringBuilder();
var barcodes = reader.ReadBarCodes();
foreach (BarCodeResult result in barcodes)
{
listBox1.Items.Add($“{result.CodeText} -->( {result.CodeType} )”);
}
}
@jithus.tvr,
Could you please zip and attach the TIFF file here. We will check your issue soon.
By the way, I tested with your provided (barcode) image file, i.e., “image.png” which has some barcodes but with poor quality. To get all barcodes with deteriorated quality, I did use QualitySettings.HighQuality for it. I tried to use the following sample code and it gives all possible resultant barcodes from it.
var bmp1 = "e:\\test2\\image.png";
using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader1 = new Aspose.BarCode.BarCodeRecognition.BarCodeReader(bmp1))
{
reader1.QualitySettings = QualitySettings.HighQuality;
foreach (Aspose.BarCode.BarCodeRecognition.BarCodeResult result1 in reader1.ReadBarCodes())
{
// Read symbology type and code text
Console.WriteLine("Symbology Type: " + result1.CodeType);
Console.WriteLine("CodeText: " + result1.CodeText);
}
}
console output:
Symbology Type: Code39
CodeText: DTPINV
Symbology Type: EAN8
CodeText: 42261612
Symbology Type: Code39
CodeText: S6ID0C2
I am using Aspose.BarCode 25.6.0.0. Are these not valid results?
SCN0001_Page_0001m.zip (58.0 KB)
here the tif files.
@jithus.tvr,
Thanks for the TIFF (barcode) images.
I tested your scenario/case using your both TIFF images with Aspose.BarCode 25.6.0.0. I have used the following sample code to read barcodes from the image(s).
e.g.,
Sample code:
var bmp1 = "e:\\test2\\SCN0001_Page_0001.tiff";
//var bmp1 = "e:\\test2\\SCN0001_Page_0001m.tiff";
using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader1 = new Aspose.BarCode.BarCodeRecognition.BarCodeReader(bmp1))
{
foreach (Aspose.BarCode.BarCodeRecognition.BarCodeResult result1 in reader1.ReadBarCodes())
{
// Read symbology type and code text
Console.WriteLine("Symbology Type: " + result1.CodeType);
Console.WriteLine("CodeText: " + result1.CodeText);
}
}
console output (SCN0001_Page_0001.tiff) - time taken 3 seconds:
Symbology Type: Code39
CodeText: DTPINV
Symbology Type: Code39
CodeText: ZC2INPUTQ
Symbology Type: EAN8
CodeText: 51811112
console output (SCN0001_Page_0001m.tiff) - time taken 3 seconds:
Symbology Type: Code39
CodeText: QTPINV
Symbology Type: Code39
CodeText: ZC25I5BG
Symbology Type: Code39
CodeText: 62LGPE
I guess the results are ok, aren’t they? What are your results on desktop machine? What are your expected results? We will look into it further.
When am reading SCN0001_Page_0001m.tiff from an windows application am getting another value for last barcode
QTPINV -->( Code39)
ZC25I5IQ -->( Code39)
SSIDZC2 -->( Code39)
but i wondered one of out automated service project am getting the values (QTPINV,ZC25I5BG,62LGPE) respectively. Same version and same code am used there also
image.png (1.8 KB)
here the code am used.
using (BarCodeReader reader = new BarCodeReader(txtFileName.Text))
{
DateTime start = DateTime.Now;
if (chkHighPerformance.Checked)
reader.QualitySettings = QualitySettings.HighPerformance;
StringBuilder barcodeData = new StringBuilder();
var barcodes = reader.ReadBarCodes();
foreach (BarCodeResult result in barcodes)
{
barcodeData.Append($"{result.CodeText} -->( {result.CodeType})\n");
}
MessageBox.Show("Read Completed");
}
@jithus.tvr,
Please don’t set the QualitySettings or try default settings using the following line instead:
reader.QualitySettings = QualitySettings.NormalQuality;
Maybe you are using different settings and some other code snippet in that Windows app, so please check it on your end. Also, make sure you are using the same Aspose.BarCode version on that machine.
@jithus.tvr
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): BARCODENET-39377
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Barcodes on the provided image are classified as “Class 0” according to ISO/IEC 15416 Bar code print quality test specification — Linear symbols. Recognition of Class 0 barcodes is not required by the standard, and such low-quality symbols may not be reliably decoded by any software.
Additionally, Code 39 barcodes do not include a mandatory checksum. Code 39 is a self-checking symbology designed in 1974, and it relies on high print quality for reliable recognition. As a result, barcodes of this quality may be misread because there is no way to verify their correctness without a checksum.
To enable recognition of barcodes with such low quality, our engine applies heuristic methods from machine intelligence and computer vision. However, in challenging cases, these heuristics may occasionally misinterpret the barcode, similar to how AI can sometimes “hallucinate.”