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

Posted by Ahmedsa under C# on 12/19/2016 | Points: 10 | Views : 519 | Status : [Member] | Replies : 1
Problem
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

c/nasa.jpg




Responses

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

Up
0
Down

Resolved
It appears you have asked this question on MSDN and I answered you there.
https://social.msdn.microsoft.com/Forums/en-US/b967e460-539e-4823-9b34-c5c834bf0848/how-to-put-image-logo-within-generated-qr-code?forum=csharpgeneral

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:
https://www.leadtools.com/sdk/barcode-pro

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

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

Login to post response