Free Support Forum -

Extract QR code from a TIFF File


Currently we are evaluating Aspose libraries and after being able to generate a PDF document from a word template, and including a QR image on it, we are trying to read back the info from the printed/scanned document.

The problem is that after marking the QR code in the Aspose OMR Template Editor, we try to read the data of the QR image and it come’s back empty. Is there any special setting we might have to add?

This is the code we use to test the template and tiff file:

//Load template file
OmrTemplate template = OmrTemplate.Load(dir+“qr-contrato-template.amr”);
//Load the image to be analyzed
OmrImage image = OmrImage.Load(“H:\ptellez\1.tif”);
// Instantiate the recognition engine for the template
OmrEngine engine = new OmrEngine(template);
// Extract data. This template has only one page.
OmrProcessingResult result = engine.ExtractData(new OmrImage[] { image });
//Load actual result from
Hashtable OmrResult = result.PageData[0];

//Get Collection of Keys
ICollection key = OmrResult.Keys;

foreach (string k in key)
Console.WriteLine(k + ": " + OmrResult[k]);

Attached is the template (had to change the extension from amr to txt to attach the file) and the tiff file.
Hi Patricio,

Thank you for considering Aspose APIs.

We have evaluated the presented scenario on our end while using the OMR Template Editor as well as the code snippet provided below. It is working as desired. Please, note that OMR Template Editor do not recognize QR code (BarCode element) in the evaluation mode. You have to provide License setting while using OMR Template Editor as well as in the code.

Code Sample:
string templateFile = @"C:\Ctrash\OMR\qr-contrato-template.amr";
string imageFile = @"C:\Ctrash\OMR\1.TIF";
// do not forget to set the license for BarCode in case BarCode elements are used
Aspose.BarCode.License licenseBarCode = new Aspose.BarCode.License();
// Loading the template
OmrTemplate template = OmrTemplate.Load(templateFile);
// Adding BarCode element requires creation of BarcodeElement object
// While specifying the barcode display name, its position and size
BarcodeElement barcodeElement = new BarcodeElement("Aztec BarCode",
new System.Drawing.PointF(104, 105), new System.Drawing.SizeF(24, 24));

// Add the BarCode element to the page element collection
// Create an instance of OmrImage and load the image using file path
OmrImage image = OmrImage.Load(imageFile);
// Create an instance of OmrEngine and load the template using file path
OmrEngine engine = new OmrEngine(template);
// Extract OMR data and store the results in an instance of OmrProcessingResults
OmrProcessingResult result = engine.ExtractData(new OmrImage[] { image });
// Get all page data into an instance of Hashtable
Hashtable[] pages = result.PageData;
// Loop over all the pages
foreach (Hashtable page in pages)
// Display key and value
foreach (string key in page.Keys)
Console.WriteLine("key: " + key + ": " + "value: " + page[key]);

In the above code snippet, different values for position and size have been used to define a BarCode element. You can get these values from properties of BarCode element in the OMR Template Editor.

  • Horizontal Offset & Vertical Offset for position of the BarCode element.
  • Width & Height for size of the BarCode element.

Try the above code at your end. In case you have any queries, please be sure to let us know, we will be glad to assist you.


Since to test QR recognition we need a proper license, is there any way to acquire a test license for a fixed period of time to let us check the functionality?

Since we dont have the license, the code provided by you currently fails on my side.

Hi Patricio,

Yes, you can get a temporary license in order to evaluate the Aspose products. Please check the below linked web page and follow the instructions on it to get your temporary license.

In case you have any queries, please be sure to let us know, we will be glad to assist you.