Generate Barcode Having A Logo/Image/Picture In Place of Codetext And Identify Type of Code128 Barcode with Aspose.BarCode for Java 17.6

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Aspose.BarCode for Java logo We are pleased to announce the release of Aspose.Barcode for Java 17.6. The major development in this release is the support to generate the barcode with a logo/image inside the barcode image in place of codetext. This release also supports to identify the type of Code128 coded barcode while performing barcode recognition.

Create Barcode with Image Inside It Instead of Codetext

Aspose.BarCode now supports generating barcode with logo/other image inside it in place of codetext. How a logo/image/picture can be embed inside the barcode image in place of codetext is very simple and is demonstrated in the code snippet given below.

// Create an instance of BarCodeBuilder class
// Set the barcode text
// Set the barcode symbology 
com.aspose.barcode.BarCodeBuilder builder = new com.aspose.barcode.BarCodeBuilder("123456789012", com.aspose.barcode.EncodeTypes.EAN_13);

// Generate Barcode image and store it
java.awt.image.BufferedImage barcode = builder.generateBarCodeImage();

// Load the logo/other image from disk
java.awt.image.BufferedImage picture ="path_to_your_picture.png"));

// Create a new empty image with new Calculated height & width
java.awt.image.BufferedImage output = new java.awt.image.BufferedImage(
        Math.max(barcode.getWidth(), picture.getWidth()), barcode.getHeight() + picture.getHeight(), 

// Get the Graphics object
java.awt.Graphics g = output.getGraphics();

// Set the canvas color

// Draw the primary image (barcode image) on the canvas
g.drawImage(picture, 0, 0, null);

// Draw the second image (logo image) on the canvas inside the barcode image
g.drawImage(barcode, 0, picture.getHeight(), null);

// Save the final barcode image imageFile = new"output.png");
javax.imageio.ImageIO.write(output, "PNG", imageFile);

Identify Type of Code128 Barcode

Aspose.BarCode for Java provides the functionality to identify the type of Code128 coded barcode while performing barcode recognition operation. How to identify the type is very simple and is demonstrated in code snippet below.

// Create an instance of BarCodeReader class
// Set file path
// Set the recognition type
com.aspose.barcode.barcoderecognition.BarCodeReader reader = 
        new com.aspose.barcode.barcoderecognition.BarCodeReader("1bc.png", com.aspose.barcode.barcoderecognition.DecodeType.CODE_128);

// Perform read operation;

// Create an array of Code128DataPortion class
// Call the GetCode128DataPortions method
com.aspose.barcode.barcoderecognition.Code128DataPortion[] code128DataPortions = reader.getCode128DataPortions();

// Execute Loop for each Code128DataPortion instance
for (com.aspose.barcode.barcoderecognition.Code128DataPortion code128DataPortion : code128DataPortions)
    // Display the subtype and data
    System.out.println("Code128SubType: " + code128DataPortion.getCode128SubType());
    System.out.println("Data:" + code128DataPortion.getData());


Complete list of enhancements and fixes in this release is as follows.

  • Functionality to read the supplement code text from EAN13 coded barcode has been improved.
  • Functionality to recognize EAN13 barcode has been improved. Recognition process was recognizing EAN13 coded barcode as UPC-A. Recognition algorithm has been improved in much a way that it is now capable of correctly recognizing EAN13 coded barcode.

To view a complete list of new features, fixes and to download the latest release, please visit Aspose.Barcode for Java 17.6 page in downloads section.

Aspose.BarCode for Java Resources

The following API resources can be of help to you in getting started with Aspose.BarCode:

To keep up with our news, you can follow us on Twitter or follow our Facebook page.

Leave a Reply