C# Tutorial - Generate QR Code with Logo | FoxLearn
Вставка
- Опубліковано 12 гру 2024
- Generate custom QR Code with logo image inside using zxing net library in c# project windows forms application.
ZXing.Net is a port of ZXing, an open-source, multi-format 1D/2D barcode image processing library originally implemented in Java.
It has been ported by hand with a lot of optimizations and improvements.
It is compatible with .Net 2.0, .Net 3.5, .Net 4.x, Windows RT Class Library and Components, UWP, .Net Standard 1.x and 2.0x, .Net Core App 3.x, Silverlight 4, Silverlight 5, Windows Phone 7.x and Windows Phone 8.x and Xamarin.Android
Website: foxlearn.com
Through this video you will learn the following topics:
zxing qr code generator c#
Create a QR Code With a Custom Logo Inside in c#
How to put image logo within generated qr code c#
How do create QR code with logo in the middle c#
Generate custom QRCode with logo image using zxing library
c# qr code generator with logo
c# qr code generator nuget
qr code generator in c# windows application
qr code reader c# open source
c# qr code reader
c# qr code generator
decode qr code to text using zxing barcode reader c#
Decode QR Code images in .NET framework projects with the C#.NET
Thanks so much for the job.
How do I create a button to save an image from "pictureBox1" to a specific folder?
OK. Thank you for your suggestion. I'll upload soon !
@@foxlearn oh, good. Thanks so much! 💪🏻
Thanks for this!!
One issue I am having though. No matter what size logo I use I can't seem to get it to be centered within the QRCode. For example, bitmap height and width are 300. Logo height and width are 150. This results in my logo located just to the lower right of the top left corner box in QRCode. I am using the following line to draw the logo onto the bitmap image:
g.DrawImage(logo, new Point((bitmap.Width - logo.Width) / 2, (bitmap.Height - logo.Height) / 2));
Which is exactly same as your code. Any ideas?
[NonAction]
private static Byte[] BitmapToBytesCode(Bitmap image)
{
using (MemoryStream stream = new MemoryStream())
{
image.Save(stream, ImageFormat.Png);
return stream.ToArray();
}
}
[Obsolete]
public IActionResult PicInQrCode([FromForm] QRcodeViewModel qRcode)
{
qRcode.QrCodeString = $"{Request.Scheme}://{Request.Host.Value}/POS/KRMS";
string wwwPath = _environment.WebRootPath;
string imglogo = Path.Combine(wwwPath, "Images/company/Kernel.jpg");
BarcodeWriter barcodeWriter = new BarcodeWriter();
EncodingOptions encodingOptions = new EncodingOptions() { Width= 500, Height = 500, Margin = 0, PureBarcode = false };
encodingOptions.Hints.Add(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
barcodeWriter.Renderer = new BitmapRenderer();
barcodeWriter.Format = BarcodeFormat.QR_CODE;
Bitmap bitmap = barcodeWriter.Write(qRcode.QrCodeString);
var img = Image.FromFile(imglogo);
Bitmap logo = new Bitmap(img, 20, 20);
Graphics g = Graphics.FromImage(bitmap);
int width = (bitmap.Width - logo.Width) / 2;
int height = (bitmap.Height - logo.Height) / 2;
g.DrawImage(logo, new Point(width, height));
string data = String.Format("data:image/png;base64,{0}", Convert.ToBase64String(BitmapToBytesCode(bitmap)));
return Ok(data);
}
Wow thank you.
Is there a Video how I create a lokale db and read thinks with C#?
Also is there a Video how to create in one Form multiple layer for Tabs?
OK. Thank you for your suggestion
I read a TXT file in to a TEXTBOX, but can not generate the QR code.... error = find empty spaces
Which size have your .png? When I try it with a 300x300 or higher .png I can't see the QR Code.
Edit: I added "Bitmap resize_logo = new Bitmap(logo, new Size(150, 150));"
You should change qr code size, instead of image
Barcodewriter accept a argument
And BitmapRenderer namespace does not exist
so basically it's not working
I need a reply
You should install the library
Great! plzz make a video on How to use QR code used as a password or as a security purpose??
Thank you for your suggestion !
how to increase resolution. 96dpi are generated image
genial y gracias por enseñarnos like y suscrito
All Works 🤗
Great 👍
how can i download video from youtube in c# plz
👏👏
Thank you !
Thanks for the job.
Thank you so much !
i need multiline text ..how to set?
Excellent! Grateful!
Thank you !
ขอบคุณมากครับ
thks u so much. so good!
Thank you !
like your learn
Thank you so much !
thanks !!
Thank you !
Popcm you hopland American 🎉❤❤❤❤❤❤❤❤🎉
the logo doesn't come out
same, it doesn't work!