Create QRCode with logo

I following the URL to create a QR code with logo. However, the center of QR code is covered with logo image and QR code reader can’t recognize it successfully. Can I set a blank area in the center of QRCode image, for example, set 50 x 50 blank area. and create a QR code image with 300 x 300.

@fubon.com,

You may try setting the alpha value for the logo as shown in the code snippet below. This will make the barcode visible by adding transparency to the logo.

// Draw the primary image (barcode image) on the canvas
g.drawImage(image, 0, 0, null);
// changed alpha value from 1f to .3f [line 37 in sample code]
g.setComposite(java.awt.AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .3f));

We hope that this resolves the issue you were facing. In case the issue is not fixed, please provide a sample image the shows the output you are trying to generate. This will help us in understanding your requirements better and assisting you further.

Main advice here, use QR with QRErrorLevel.LevelH. It allows to recover 30% corrupted image. In the main case any logo inside QR is barcode damage and it could make it unrecognizable on some weak barcode readers. In this way you can try it with QRErrorLevel.LevelH however you can have problems with your barcode reading by the customers applications.