PNG JPG BMP TIFF SVG
Aspose.BarCode  for Python via Java
Standard 2 of 5

Read Standard 2 of 5 Barcodes with Python via Java

Read Standard 2 of 5 (Industrial 2 of 5) barcode in Python using server-side Aspose.BarCode for Python via Java API

How to Read Standard 2 of 5 barcode Using Python via Java

To scan and decode Standard 2 of 5 barcode, install Aspose.BarCode for Python via Java API, a versatile, powerful, and easy-to-use barcode library for Python-based applications. Get the latest version directly from the Aspose releases portal or install ‘aspose-barcode’ from pip by running the following command:

Command

  pip install aspose-barcode 

Steps for Scanning Standard 2 of 5 barcode in Python

Aspose.BarCode allows developers to read Standard 2 of 5 barcode barcodes from stream or image with few lines of code

  • Create an object of Aspose.BarCode.BarCodeReader class
  • Define the source file path containing Standard 2 of 5 barcode as a parameter
  • Determine the required barcodes types in DecodeType as the second parameter
  • Loop through the decoding outcomes
  • Get the barcode text using the CodeText property

System Requirements

Aspose APIs are supported on all major platforms and operating systems. Before executing the code sample below, please make sure that your system comply with the following requirements.

  • Microsoft Windows, Linux, or any OS compatible with Python-based developement environments
  • Java 8 or above
  • Python 3.6 or above
  • PHP/Java Bridge installed
  • FastCGI and Tomcat Server 8.0 or above
Ready to recognize Recognizing Drop a file here or click to browse *

* By uploading your files or using the service you agree with our Terms of use and Privacy Policy.

Code to be executed - Python

    
import os
import base64
from asposebarcode import Recognition

class BarcodeReaderExamples():
    def readBarcodeImage(self):
        image_data_base64 = ta.load_image_base64_from_path("<file name>")
        reader = Recognition.BarcodeReader(image_data_base64, None, Recognition.DecodeType.Standard2of5)
        recognized_results = reader.readBarCodes()
        for x in recognized_results:
            print(x.getCodeText())
            print(x.getCodeTypeName())

    def load_image_base64_from_path(filePath):
        try:
            image_file = open(filePath, "rb")
            image_data_binary = image_file.read()
            return (base64.b64encode(image_data_binary)).decode('ascii')
        except Exception as ex:
            print('Failed to save image\\n ' + str(ex))
        
barcodeReaderExamples = BarcodeReaderExamples()
barcodeReaderExamples.readBarcodeImage()

×
Barcode image

Other Supported Barcode Recognition Symbologies

Using Python via Java, One can also read barcode of different symbologies including the following.

2D:

Linear:

Postal: