Aspose.BarCode  for Python via Java

Python Barcode library

Recognize or Generate 1D, 2D and Postal barcodes in any Python application.

  Download Free Trial

Aspose.BarCode for Python via Java is a set of barcode generation and reading APIs to be integrated in Python applications by using the python-java bridge. Developers can easily add barcode generation and recognition functionality. This barcode API based on Python creates barcode images and save them in various formats, such as PNG, JPG, GIF, BMP, and TIFF. It supports various imaging features like customizing borders, color scheme, rotating angle, resolution, and a lot more.

Advanced Python via Java Barcode API Features

Save Barcodes in Various Formats

The barcode library provides various options to save generated barcodes not only using popular raster image formats but also to stream or vector. Barcodes can be downloaded using one of the five most widely used image formats or two vector formats. It is also possible to load barcodes as files, streams, or bitmaps. Developers can customize the process of barcode generation and saving according to specific business needs by setting the required output mode. The API supports the following file formats: BMP, PNG, GIF, JPEG, and TIFF for input/output; EMF and SVG for output. Developers can save barcodes as vector images, such as EMF and SVG files, to scale them without losses in resolution. It is possible to output generated barcodes as streams (using the binary format). This mode can be used to abstract from the use of specific operating systems and particular output devices. The API also enables firstly saving barcodes as bitmap objects and then downloading them in the required file format or processing further. Such objects use a grid of pixels to represent an image. Each pixel in a bitmap is represented by a binary value, which specifies whether the pixel is filled or empty. Bitmap objects serve to represent and manipulate images. They are commonly used in graphics and imaging software.

QR Code Generation

This barcode API has the capability to generate barcodes of the mostly used 2D types, including Data Matrix, Aztec Code, PDF417, and so on, for large or non-standard values to be encoded. The following code sample describes QR Code generation.

Code to be executed - Python

from asposebarcode import Generation

class BarcodeGeneratorExamples():
    def generateBarcodeImageExample(self):
        generator = Generation.BarcodeGenerator(Generation.EncodeTypes.QR, "")
        generator.getParameters().getBarcode().getXDimension().setMillimeters(2)"example.png", "PNG")

barcodeGeneratorExamples = BarcodeGeneratorExamples()
Generation result

Optimized Barcode Scanning and Decoding

One of the features of Aspose.BarCode for Python via Java is the ability to customize the barcode reading process by using different presets. These are pre-defined sets of reading parameters that are optimized for different scenarios and can help improve the accuracy and speed of barcode recognition. For example, some presets can be used to improve the recognition of small, low-quality, or damaged barcodes, as well as barcodes that are scanned from complex text documents or that are rotated at an angle. Other presets can be used to increase the reading speed for high-quality images and linear barcodes. Using these presets, developers can fine-tune the barcode reading process to maximize recognition accuracy and efficiency for their specific use cases. This can improve the overall performance of their applications and provide a better user experience for their customers.

Barcode Recognition Live Example

The barcode reader API provides a set of features for scanning, detecting, and reading 1D, 2D, and postal barcodes. With just a few lines of code, developers can easily integrate this functionality into their applications and use it to detect and decode a wide range of commonly used barcodes. The API is designed to be user-friendly and intuitive, making it easy for developers to add barcode scanning capabilities to their Python applications quickly and easily.

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.AllSupportedTypes)
        recognized_results = reader.readBarCodes()
        for x in recognized_results:

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

Recognition result

What People Are Saying

Don't just take our word for it. See what users have to say about APIs.

View Case Studies

Support and Learning Resources