AZTEC 2D Decoder Library for Polish Vehicle ID Cards

Programming library to decode vehicle & owner personal data from Polish vehicle registration / certificate cards stored in the form of an AZTEC 2D image.

AZTec Decoder

We offer you a software library and Web API service that allows you to decode the data from the AZTEC 2D images found on Polish vehicle registration ID cards.

Our library decodes the data directly from the AZTEC code, all of the supported fields of the vehicle ID cards are included in the output data.

Polish vehicle registration ID card with the AZTEC 2D image code

Where can AZTec Decoder be used?

AZTec Decoder can be useful to companies and institutions that want to automate the manual data entry of registration ID cards, and replace it with our library that can recognize and decode AZTEC 2D codes, whether directly from image files or pre-scanned codes in text form (from a QR / AZTEC 2D scanner).

Insurance company
Insurance companies
Bank
Banks
Government institution
Government institutions
Software company
Software companies
Car repair shop
Car repair shops
Your company
Your company?

Available programming editions

AZTec Decoder is available in three editions. Each version has different characteristics and different decoding capabilities. The Web API edition is the only one with the ability to recognize and decode data directly from images and pictures. The other versions require images to be pre-scanned into text form (e.g. using a hand scanner) in order to decode the data.

Features Web API Sources Binary
QR Code Decoding directly from images & pictures (PNG/JPG)
Scanner Decoding from pre-scanned codes (text)
Source code Decoding algorithm source code
Code Usage examples
JSON Format JSON output format
XML Format XML output format
World Internet connection required
License management Lifetime license
Update Free updates
Technical support Free technical support

Web API edition

This is the most advanced edition of the AZTec Decoder, because it allows precise recognition and decoding of AZTEC 2D codes directly from images and pictures stored in PNG or JPG formats.

The image recognition algorithm belongs to our company. It is an innovative solution developed from the ground up over almost a year.

We understand our customers' needs and problems resulting from the recognition of real AZTEC 2D images contained in vehicle ID registration documents, which are not always perfectly done, whether it be due to the type of camera angle, reflections, or low resolution.

When creating our solution we took all these factors into account and as a result, our algorithm is capable of recognition of AZTEC 2D images with all sorts of distortions, damage and imperfections. It significantly surpasses the capabilities of available AZTEC 2D image recognition libraries available on the market, such as ZXing.

Decoding AZTEC 2D code to JSON format

Installation

For faster deployment, AZTec Decoder installation packages have been uploaded to popular package repositories for several programming languages, and the source versions have also been published on Github:

Repository Language Installation Package Sources
Maven Central Repository Java Add this dependency to your pom.xml
<dependency>
  <groupId>com.pelock</groupId>
  <artifactId>AZTecDecoder</artifactId>
  <version>1.0.0</version>
</dependency>
Maven GitHub
npm repository JavaScript for Node.js
npm install aztec-decoder
npm GitHub
NuGet repository C#, VB.NET
PM> Install-Package AZTecDecoder
NuGet GitHub
Packagist Repository for Composer PHP

Add to require section of your composer.json file

"pelock/aztec-decoder": "*"
Packagist GitHub
PyPI Repository for Python Python
pip install aztecdecoder
PyPI GitHub

Web API usage examples

The Web Interface API is based on a simple POST request to our server, which returns the output data as a JSON formatted string. The decoder can be used from any programming language with network communication functions and a JSON decoder. Usage examples for several popular programming languages:

//
// include decoder class (available as a Maven dependency)
//
import com.pelock.AZTecDecoder;
import org.json.JSONObject;

public static void main(String[] args)
{
	// create a decoder class (we use our license key to initialize it)
	AZTecDecoder myAZTecDecoder = new AZTecDecoder("ABCD-ABCD-ABCD-ABCD");

	//
	// 1. Decode data directly from the image file, return result as an array
	//
	JSONObject DecodedArray = myAZTecDecoder.DecodeImageFromFile("C:\\vehicle-id-image.jpg");

	// check the decoding result
	if (DecodedArray != null && (Boolean)DecodedArray.get("Status") == true)
	{
		// display decoded data (the are stored as an associative array)
		System.out.println(DecodedArray.toString(4));
	}

	//
	// 2. Decode data directly from the image file, return result as an JSON string
	//
	JSONObject DecodedJSON = myAZTecDecoder.DecodeImageFromFile("C:\\aztec-code-photo-2d.png");

	if (DecodedJSON != null)
	{
		System.out.println(DecodedJSON.toString(4));
	}

	//
	// 3. Decode data from pre-scanned code in text format (e.g. using hand scanner)
	//
	// encoded data read from the vehicle ID certificate
	String szValue = "ggMAANtYAAJD...";

	JSONObject DecodedText = myAZTecDecoder.DecodeText(szValue);

	if (DecodedText != null)
	{
		System.out.println(DecodedText.toString(4));
	}

	//
	// 4. Decode data from pre-scanned code (e.g. using hand scanner) in text format stored in a file
	//
	JSONObject DecodedTextFile = myAZTecDecoder.DecodeTextFromFile("C:\\scanned-aztec-2d-code-as-text.txt");

	if (DecodedTextFile != null)
	{
		System.out.println(DecodedTextFile.toString(4));
	}
}
//
// include decoder module for the Node.js (installed with "npm install aztec-decoder" command)
//
var AZTecDecoder = require('aztec-decoder');

// initialize the decoder (using our license key)
AZTecDecoder.SetApiKey("ABCD-ABCD-ABCD-ABCD");

//
// 1. Decode data directly from the image file, return result as an array of JSON items
//
AZTecDecoder.DecodeImageFromFile("C:\\vehicle-id-image.jpg", function(DecodedArray) {

    // check the decoding result
    if (DecodedArray !== null && DecodedArray["Status"] === true)
    {
        // display decoded data (which is stored as an associative array of JSON items)
        console.log(JSON.stringify(DecodedArray, null, "\t"));
    }
});

//
// 2. Decode data directly from the image file, return result as an array of JSON items
//
AZTecDecoder.DecodeImageFromFile("C:\\aztec-code-photo-2d.png", function(DecodedJSON) {

    if (DecodedJSON !== null)
    {
        console.log(JSON.stringify(DecodedJSON, null, "\t"));
    }
});

//
// 3. Decode data from pre-scanned code in text format (e.g. using hand scanner)
//
// encoded data read from the vehicle ID certificate
var szValue = "ggMAANtYAAJD...";

AZTecDecoder.DecodeText(szValue, function(DecodedText) {

    if (DecodedText !== null)
    {
        console.log(JSON.stringify(DecodedText, null, "\t"));
    }
});

//
// 4. Decode data from pre-scanned code (e.g. using hand scanner) in text format stored in a file
//
AZTecDecoder.DecodeTextFromFile("C:\\scanned-aztec-2d-code-as-text.txt", function(DecodedTextFile) {

    if (DecodedTextFile !== null)
    {
        console.log(JSON.stringify(DecodedTextFile, null, "\t"));
    }
});
//
// include decoder class (installed with 'php composer.phar require --prefer-dist pelock/aztec-decoder "*"' command)
//
include_once "AZTecDecoder.php";

//
// create a decoder class (we use our license key to initialize it)
//
$myAZTecDecoder = new PELock\AZTecDecoder("ABCD-ABCD-ABCD-ABCD");

//
// 1. Decode data directly from the image file, return result as an array
//
$DecodedArray = $myAZTecDecoder->DecodeImageFromFile("vehicle-id-image.jpg");

// check the decoding result
if ($DecodedArray !== false && $DecodedArray["Status"] === true)
{
	// display decoded data (which is stored as an associative array)
	var_dump($DecodedArray);
}

//
// 2. Decode data directly from the image file, return result as an JSON string
//
$DecodedJSON = $myAZTecDecoder->DecodeImageFromFile("aztec-code-photo-2d.png", false);

if ($DecodedJSON !== false)
{
	echo $DecodedJSON;
}

//
// 3. Decode data from pre-scanned code in text format (e.g. using hand scanner)
//
$DecodedText = $myAZTecDecoder->DecodeText("ggMAANtYAAJD...");

if ($DecodedText !== false)
{
	var_dump($DecodedText);
}

//
// 4. Decode data from pre-scanned code (e.g. using hand scanner) in text format stored in a file
//
$DecodedTextFile = $myAZTecDecoder->DecodeTextFromFile('/path/scanned-aztec-2d-code-as-text.txt');

if ($DecodedTextFile !== false)
{
	var_dump($DecodedTextFile);
}
//
// include decoder class (installed as a NuGet package "PM> Install-Package AZTecDecoder")
//
using PELock;

private void AZTecDecoderTest()
{
    //
    // create a decoder class (we use our license key to initialize it)
    //
    var myAZTecDecoder = new AZTecDecoder("ABCD-ABCD-ABCD-ABCD");

    //
    // 1. Decode data directly from the image file, return result as an array of JSON items
    //
    var decodedArray = myAZTecDecoder.DecodeImageFromFile(@"C:\path\vehicle-id-image.jpg");

    // check the decoding result
    if (decodedArray != null && decodedArray["Status"] == true)
    {
	// display the decoded data (which is stored as a table of JsonValue elements)
	textOutput.Text = decodedArray.ToString();
    }

    //
    // 2. Decode data directly from the image file, return result as an array of JSON items
    //
    var decodedFromImage = myAZTecDecoder.DecodeImageFromFile(@"C:\path\aztec-code-photo-2d.png");

    if (decodedFromImage != null)
    {
	MessageBox.Show(decodedFromImage.ToString());
    }

    //
    // 3. Decode data from pre-scanned code in text format (e.g. using hand scanner)
    //
    // encoded data read from the vehicle ID certificate
    var szValue = "ggMAANtYAAJD...";

    var decodedText = myAZTecDecoder.DecodeText(szValue);

    if (decodedText != null)
    {
	MessageBox.Show(decodedFromImage.ToString());
    }

    //
    // 4. Decode data from pre-scanned code (e.g. using hand scanner) in text format stored in a file
    //
    var DecodedTextFile = myAZTecDecoder.DecodeTextFromFile(@"C:\path\scanned-aztec-2d-code-as-text.txt");

    if (DecodedTextFile != null)
    {
	MessageBox.Show(DecodedTextFile.ToString());
    }
}
#
#  include decoder module (installed with "pip install aztecdecoder" command)
#
from pelock import aztecdecoder
from pprint import pprint

# create a decoder class (we use our license key to initialize it)
aztec_decoder = aztecdecoder.AZTecDecoder("ABCD-ABCD-ABCD-ABCD")

#
# 1. Decode data directly from the image file, return result as an array of JSON items
#
decoded_array = aztec_decoder.decode_image_from_file("C:\\path\\vehicle-id-image.jpg")

# check the decoding result
if decoded_array and "Status" in decoded_array:

    # // display decoded data (which is stored as an associative array of JSON items)
    pprint(decoded_array)

#
# 2. Decode data directly from the image file, return result as an array of JSON items
#
decoded_json = aztec_decoder.decode_image_from_file("C:\\path\\aztec-code-photo-2d.png")

if decoded_json:

    pprint(decoded_json)

#
# 3. Decode data from pre-scanned code in text format (e.g. using hand scanner)
#
# encoded data read from the vehicle ID certificate
value = "ggMAANtYAAJD...";

decoded_text = aztec_decoder.decode_text(value)

if decoded_text:

    pprint(decoded_text)

#
# 4. Decode data from pre-scanned code (e.g. using hand scanner) in text format stored in a file
#
decoded_text_file = aztec_decoder.decode_text_from_file('C:\\path\\scanned-aztec-2d-code-as-text.txt')

if decoded_text_file:

    pprint(decoded_text_file)

Source code and binary library edition

Our solution is available as a compiled DLL Windows library (32 & 64-bit versions) and it can be used in any programming language that supports DLL libraries.

In addition, we have prepared native versions with source code in selected programming languages. It is worth mentioning that the native implementations are not dependent on any external libraries or references.

The library has only one decoding function. The input is the scanned AZTEC 2D code, the output is returned as a Unicode XML string containing all the decoded data (including personal information). The PHP version can also return data in JSON format.

The wide array of supported programming languages makes this the perfect solution for all sorts of hardware platforms as well as operating systems like Windows, Linux, OSX, iOS, and Android.

Programming language Binaries Sources
Java programming language Java
Delphi & Pascal programming languages Delphi / Pascal
Visual Basic & VBA programming languages Visual Basic / VBA
C & C++ programming languages C / C++
C# Sharp programming language C#
PHP programming language PHP
Python programming language Python
Ruby programming language Ruby

Usage examples

The decoding library can be used in many programming languages. Just a few examples:

public static void main(String[] args)
{
	// create decoder instance
	com.AZTecDecoder.AZTecDecoder myAZTecDecoder = new com.AZTecDecoder.AZTecDecoder();

	// scanned AZTEC 2D code as an ASCII string
	String szValue = "gQMAANtYA...";

	// decode data
	String szDecoded = myAZTecDecoder.DecodeValue(szValue);

	// display XML dump of the decoded data
	System.out.print(szDecoded);
}
// decoding function declaration for Delphi
function DecodeValue(Value: WideString): WideString; stdcall; external 'AZTecDecoder.dll';

procedure TFormMain.ButtonDecodeClick(Sender: TObject);
var
  DecodedXml: WideString;
begin

  // decode data (read it from the Memo control)
  Decoded := DecodeValue(MemoEncoded.Text);

  // exit on error
  if Decoded = '' then Exit;

  // write XML dump of the decoded data
  WStrToFile('XmlUnicode.xml', Decoded);

end;
' decoding function declaration for Visual Basic / VBA
Private Declare Function DecodeValueVBA Lib "AZTecDecoder.dll" (ByVal Value As String, ByRef Output As String) As Integer

Sub AztecDecoder_Test()

  Dim Value As String
  Dim Xml As String
  Dim Result As Integer

  ' Scanned AZTEC 2D code as an ASCII string
  Value = "gQMAANtYA..."

  ' Decode data
  Result = DecodeValueVBA(Value, Xml)

  ' Display XML dump of the decoded data
  MsgBox (Xml)

End Sub
#include "AZTecDecoder.h"

int main(void)
{
	/* scanned AZTEC 2D code in ASCII form */
	const wchar_t wszValue[] = L"gQMAANtYA...";

	/* output buffer pointer for the decoded data */
	wchar_t *wszDecoded = NULL;

	/* decode scanned data into XML dump */
	wszDecoded = DecodeValue(wszValue);

	/* display XML dump of the decoded data on success */
	if (wszDecoded != NULL)
	{
		wprintf(wszDecoded);

		/* release memory buffer */
		free(wszDecoded);
	}
	else
	{
		wprintf(L"Cannot decode the data!");
	}

	return 0;
}
#define UNICODE
#include <stdlib.h>
#include <stdio.h>
#include <tchar.h>
#include <conio.h>

#include "AZTecDecoder.h"

int DecoderTest()
{
	HMODULE hAZTecDecoder = NULL;
	DECODEVALUECPPSIZE pDecodeValueCPPSize = NULL;
	DECODEVALUECPP pDecodeValueCPP = NULL;

	unsigned int dwBufferSize = 0;
	unsigned int dwResult = 0;

	wchar_t wszValue[] = _T("gQMAANtYA...");
	wchar_t *wszXml = NULL;

	// load AZTec Decoder library
	hAZTecDecoder = LoadLibrary(_T("AZTecDecoder.dll"));

	pDecodeValueCPPSize = (DECODEVALUECPPSIZE)GetProcAddress(hAZTecDecoder, "DecodeValueCPPSize");
	pDecodeValueCPP = (DECODEVALUECPP)GetProcAddress(hAZTecDecoder, "DecodeValueCPP");

	// get the output buffer size for the decoded data
	dwBufferSize = pDecodeValueCPPSize(wszValue);

	if (dwBufferSize == 0) return 1;

	// allocate memory for the output XML dump
	wszXml = malloc(sizeof(wchar_t) * dwBufferSize);

	// decode data
	dwResult = pDecodeValueCPP(wszValue, wszXml);

	// display XML dump of the decoded data on success
	if (dwResult == 0)
	{
		wprintf(wszXml);

		// release memory
		free(wszXml);

		return 0;
	}

	// release memory
	free(wszXml);

	return 1;
}
[DllImportAttribute("AZTecDecoder.dll", EntryPoint = "DecodeValueCPPSize", CallingConvention = CallingConvention.StdCall)]
public static extern int DecodeValueCPPSize(byte[] wszValue);

[DllImportAttribute("AZTecDecoder.dll", EntryPoint = "DecodeValueCPP", CallingConvention = CallingConvention.StdCall)]
public static extern int DecodeValueCPP(byte[] wszValue, byte[] wszOutputXml);

private void buttonDecode_Click(object sender, EventArgs e)
{
	// scanned AZTEC 2D code as an ASCII string
	string szValue = textInput.Text;

	textOutput.Text = "";

	UnicodeEncoding UNICODE = new UnicodeEncoding();

	// convert input data to UNICODE string
	byte[] wszValue = UNICODE.GetBytes(szValue);

	// get the output buffer size for the decoded data
	int dwBufferSize = DecodeValueCPPSize(wszValue);

	// if the return code is 0, input data were incorrect
	if (dwBufferSize == 0)
	{
		MessageBox.Show("Incorrect data format!");
		return;
	}

	// allocate memory for the output XML dump
	byte[] lpcDecodedData = new byte[dwBufferSize];

	// decode data
	int dwResult = DecodeValueCPP(wszValue, lpcDecodedData);

	// display XML dump of the decoded data on success
	if (dwResult == 0)
	{
		string szXml = UNICODE.GetString(lpcDecodedData);

		textOutput.Text = szXml;
	}
	else
	{
		MessageBox.Show("Cannot decode the data!");
		return;
	}
}
<?php
	include_once "AZTecDecoder.php";

	// create decoder instance
	$myAZTecDecoder = new AZTecDecoder();

	// scanned AZTEC 2D code in ASCII form
	$szValue = "gQMAANtYA...";

	// additional flag for the output JSON format
	// otherwise XML is used
	$bJson = false;

	// decode data
	$szDecoded = $myAZTecDecoder->DecodeValue($szValue, $bJson);

	// send proper header for the browser in case of JSON output option
	if ($bJson == false)
	{
		header("Content-type: text/xml; charset=utf-8");
	}

	// display decoded data
	echo $szDecoded;
?>
import AZTecDecoder

# create decoder instance
myAZTecDecoder = AZTecDecoder.AZTecDecoder()

# scanned AZTEC 2D code in ASCII form
szValue = "gQMAANtYA..."

# decode data
szDecoded = myAZTecDecoder.DecodeValue(szValue)

# display XML dump of the decoded data on success
if szDecoded:
	print szDecoded
else:
	print "Cannot decode the data!"
load 'AZTecDecoder.rb'

# create decoder instance
aztec_decoder = AZTecDecoder.new

# scanned AZTEC 2D code in ASCII form
value = "gQMAANtYA..."

# decode data
decoded = aztec_decoder.DecodeValue(value)

# display XML dump of the decoded data on success
if decoded.to_s != ''
  puts decoded
else
  puts "Cannot decode the data!"
end

For an extra fee we can prepare a software implementation in any other programming language.

No additional programming dependencies

AZTec Decoder doesn't require any other programming libraries or external references to work, whether you use the source or binary version. Also, you don't have to install the library itself or any additional components.

Digital code signature

Our library is digitally signed (only for Windows), giving you assurance that it comes from a verified source. Our company had to be carefully scrutinised by the certification authority in order to receive the digital certificate for code signing.

Got questions?

If you are interested in the AZTec Decoder library or have any questions regarding AZTec Decoder, technical or legal issues, or if something is not clear, please contact me. I'll be happy to answer all of your questions.