We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Generate QR Code with Logo in the Centre using C#

Hello,

I have recently implemented the Generate QR Code with Logo using C# as outlined within the following article:

Generate Barcode with Logo using C# | Generate QR with Logo using C# (aspose.com)

However, my organisation wishes to know if there is a way to add a logo in the centre of the QR Code.

Is this supported by Aspose?

Kind regards,
Daniel

@djsomers,

You can do that but the logo image will override the underlying barcode. See the sample code segment for your reference, you got to make the logo (image) with transparent background:
e.g.,
Sample code:

// Create a new empty image with height width of the barcode
Bitmap output = new Bitmap(barcode.Width, barcode.Height);

// Get the Graphics object
using (Graphics g = Graphics.FromImage(output))
{
                // Clear the canvas 
                g.Clear(Color.White);

                // Draw the primary image (barcode image) on the canvas
                g.DrawImage(barcode, new PointF(0, 0));

                // Draw the second image (logo image) on the canvas inside the barcode image
                g.DrawImage(picture, new PointF((int)((barcode.Width - picture.Width) / 2), (int)((barcode.Height - picture.Height) / 2)));
            }

...

Hope, this helps a bit.

@Amjad_Sahi

Thanks for the response.

Wouldn’t that just obscure the QR Code and then prevent it from being scanned?

Regards,

Daniel

As a follow on, it appears that we can set up to 30% error correction to a QR Code as outlined within this document. It could be used to allow for a small image to be added to the centre of the QR Code.

QR and Micro QR Codes|Documentation (aspose.com)

@djsomers,

Yes it may effect scanning. We don’t recommend to add bigger logo on the barcodes.

Alright, if it works for your needs, you may use it.