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

КОМЕНТАРІ • 37

  • @andreamazzitelli5699
    @andreamazzitelli5699 5 років тому +2

    Thanks so much for the job.
    How do I create a button to save an image from "pictureBox1" to a specific folder?

    • @foxlearn
      @foxlearn  5 років тому

      OK. Thank you for your suggestion. I'll upload soon !

    • @andreamazzitelli5699
      @andreamazzitelli5699 5 років тому

      @@foxlearn oh, good. Thanks so much! 💪🏻

  • @stevencostello6126
    @stevencostello6126 4 роки тому +1

    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?

    • @codingtraining0102
      @codingtraining0102 3 роки тому

      [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);
      }

  • @nickm10nm
    @nickm10nm 5 років тому

    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?

    • @foxlearn
      @foxlearn  5 років тому

      OK. Thank you for your suggestion

  • @ivodonckers8936
    @ivodonckers8936 2 роки тому

    I read a TXT file in to a TEXTBOX, but can not generate the QR code.... error = find empty spaces

  • @nickm10nm
    @nickm10nm 5 років тому

    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));"

    • @foxlearn
      @foxlearn  5 років тому

      You should change qr code size, instead of image

  • @jamesoffiong5867
    @jamesoffiong5867 4 роки тому +1

    Barcodewriter accept a argument
    And BitmapRenderer namespace does not exist
    so basically it's not working

  • @ziaurrehman6630
    @ziaurrehman6630 5 років тому

    Great! plzz make a video on How to use QR code used as a password or as a security purpose??

    • @foxlearn
      @foxlearn  5 років тому +1

      Thank you for your suggestion !

  • @BojanBeslac
    @BojanBeslac 2 роки тому

    how to increase resolution. 96dpi are generated image

  • @frankramirez5318
    @frankramirez5318 3 роки тому

    genial y gracias por enseñarnos like y suscrito

  • @jhonpaulgervacio2882
    @jhonpaulgervacio2882 4 роки тому

    All Works 🤗

  • @karraralhashimi1277
    @karraralhashimi1277 5 років тому

    how can i download video from youtube in c# plz

  • @maggot008
    @maggot008 5 років тому

    👏👏

  • @Abdelkader-DZIRI
    @Abdelkader-DZIRI 5 років тому +1

    Thanks for the job.

    • @foxlearn
      @foxlearn  5 років тому

      Thank you so much !

  • @xn9fev
    @xn9fev 3 роки тому

    i need multiline text ..how to set?

  • @CezarLisboa1990
    @CezarLisboa1990 5 років тому

    Excellent! Grateful!

  • @Khunryijduy
    @Khunryijduy Рік тому

    ขอบคุณมากครับ

  • @umanleok22a
    @umanleok22a 5 років тому

    thks u so much. so good!

  • @alirezaabedi1885
    @alirezaabedi1885 5 років тому +1

    like your learn

    • @foxlearn
      @foxlearn  5 років тому

      Thank you so much !

  • @kevindanielcastillomarcelo1268
    @kevindanielcastillomarcelo1268 3 роки тому

    thanks !!

  • @Khunryijduy
    @Khunryijduy Рік тому

    Popcm you hopland American 🎉❤❤❤❤❤❤❤❤🎉

  • @kentvincent3075
    @kentvincent3075 3 роки тому

    the logo doesn't come out

    • @xMingNgw
      @xMingNgw 2 роки тому

      same, it doesn't work!