How to put image logo within generated qr code [Resolved]

Posted by Ahmedsa under C# on 12/19/2016 | Points: 10 | Views : 2639 | Status : [Member] | Replies : 2
How to put logo inside my generated bar code ?
I make windows application to generate c# qr code

I success to do that but i need to put image in center of generated bar code

But How to do that this is actually my question ?

I work in visual studio 2015 windows form applications

i using messagetoolkitqrcode

My code generated qr code by c# as following :

private void button1_Click(object sender, EventArgs e)
using (SaveFileDialog sv = new SaveFileDialog() { Filter = "JPEG|*.jpg", ValidateNames = true })
if (sv.ShowDialog()==DialogResult.OK)
MessagingToolkit.QRCode.Codec.QRCodeEncoder encoder = new MessagingToolkit.QRCode.Codec.QRCodeEncoder();
encoder.QRCodeScale = 8;
Bitmap bmp = encoder.Encode(textBox1.Text);
pictureBox1.Image = bmp;
bmp.Save(sv.FileName, ImageFormat.Jpeg);



How to put logo inside my generated bare code as following image

my logo i need to put inside qr bar code is NASA logo when i generate it as following :

AND logo found in path



Posted by: Fshahin on: 12/29/2016 [Member] Starter | Points: 50


It appears you have asked this question on MSDN and I answered you there.

I suggested that your issue may not be with QR barcode generation, but rather with combining 2 images so that the smaller logo image does not affect the readability of the barcode.

Since QR barcode is fairly robust, you can use a simple code to combine the images directly:
using (Graphics g = Graphics.FromImage(bmp))

g.DrawImage(smaller_image, (bmp.Width - smaller_image.Width), (bmp.Height - smaller_image.Height));

If you want one library to handle both barcode creation and bitmap insertion, you could use the LEADTOOLS Barcode Pro library:

(Disclaimer: I’m an employee of LEADTOOLS vendor).

Ahmedsa, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lisaw on: 1/19/2022 [Member] Starter | Points: 25

You can use Spire.Barcode library to generate QR Code with logo image.

The following is a basic example:
using Spire.Barcode;

using System.Drawing;

namespace GenerateQRCodeWithLogo
class Program
static void Main(string[] args)
//Load a license file if you have one

//Instantiate a BarcodeSettings object
BarcodeSettings settings = new BarcodeSettings();

//Specify barcode type, data, etc.
settings.Type = BarCodeType.QRCode;
settings.QRCodeECL = QRCodeECL.M;
settings.ShowText = false;
settings.X = 2.5f;
string data = "";
settings.Data = data;
settings.Data2D = data;

//Add an image to QR code
settings.QRCodeLogoImage = Image.FromFile(@"C:\Users\Administrator\Desktop\Logo.png");

//Instantiate a BarCodeGenerator object
BarCodeGenerator generator = new BarCodeGenerator(settings);
//Generate QR image
Image image = generator.GenerateImage();
//Save the image
image.Save("QR.png", System.Drawing.Imaging.ImageFormat.Png);

Ahmedsa, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response