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.
At a Glance
An overview of the barcode recognition & generation capabilities of API.
- Linear, 2D & Postal
- Detect from Stream or Image
- Get Orientation of Barcode
- Decode Non-English Characters
- Directly Print Barcode
- Linear, 2D & Postal
- Save to Stream or Image
- Customize Appearance: Size, Color, Angle
- Encode Non-English Characters
Aspose.Barcode for Python via Java uses the python-java bridge and is available for Python 3.6 and higher.
Supported File Formats
Aspose.BarCode for Python via Java works with most commonly used image file formats.
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
generator = Generation.BarcodeGenerator(Generation.EncodeTypes.QR, "")
barcodeGeneratorExamples = BarcodeGeneratorExamples()
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.
Code to be executed - Python
from asposebarcode import Recognition
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:
image_file = open(filePath, "rb")
image_data_binary = image_file.read()
except Exception as ex:
print('Failed to save image\\n ' + str(ex))
barcodeReaderExamples = BarcodeReaderExamples()
Supported Barcode Types
Using Python via Java, developers can read and generate barcodes of differen types, including the following.
What People Are Saying
Don't just take our word for it. See what users have to say about APIs.
I have spent many years developing and enhancing my product and Aspose has allowed me to make my product much more friendly and useful, and therefore more marketable. Kiel Diller | KD Solutions, Poland
Aspose.BarCode is truly written in managed code and gives us a variety of barcode types to handle all kinds of document recognition and further processing. Dennis Alexander Petrasc | Keil IT, Germany
Aspose.BarCode offers individual Barcode generation and recognition APIs for other popular development environments as listed below: