All Projects → manuelbl → QrCodeGenerator

manuelbl / QrCodeGenerator

Licence: MIT license
QR Code Generator for .NET

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to QrCodeGenerator

QRCodeFX
Simple tool to generate/read QR Code and export it.
Stars: ✭ 31 (-53.03%)
Mutual labels:  qrcode, qr-code, qr-code-generator
qr-pirate
crawl QR-codes from search engines and look for bitcoin private keys
Stars: ✭ 58 (-12.12%)
Mutual labels:  qrcode, qr-code
python
Build Python extension with Dynamsoft Barcode Reader.
Stars: ✭ 35 (-46.97%)
Mutual labels:  qrcode, qr-code
QRCode-Generator-PHP-Class
🚀 QRCode PHP class (library). QR Code Generator using vCard 4.0 and the Google Chart API
Stars: ✭ 91 (+37.88%)
Mutual labels:  qrcode, qr-code
Offline Qr Code
📱 Browser add-on allowing you to quickly generate a QR code offline with the URL of the open tab or other text!
Stars: ✭ 193 (+192.42%)
Mutual labels:  qrcode, qr-code
Jsqr
A pure javascript QR code reading library. This library takes in raw images and will locate, extract and parse any QR code found within.
Stars: ✭ 2,722 (+4024.24%)
Mutual labels:  qrcode, qr-code
QR-secret-sharing
🔒 Create QR codes to secret-share a message. Ideal for cryptocurrency wallet recovery keys and passwords.
Stars: ✭ 94 (+42.42%)
Mutual labels:  qrcode, qr-code
Barcode
barcode.php - Generate barcodes from a single PHP file. MIT license.
Stars: ✭ 141 (+113.64%)
Mutual labels:  qrcode, qr-code
WeChatQRCode
⛄ 基于OpenCV开源的微信二维码引擎移植的Android扫码识别库
Stars: ✭ 250 (+278.79%)
Mutual labels:  qrcode, qr-code
paper-store
Cold store small files on paper as QR codes -- PGP keys, Bitcoin keys, Tox keys or any other small files in general.
Stars: ✭ 28 (-57.58%)
Mutual labels:  qrcode, qr-code
quagga2-reader-qr
Quagga2 sample external reader for QR codes
Stars: ✭ 20 (-69.7%)
Mutual labels:  qrcode, qr-code
Bardecoder
Detect and decode QR Codes, written in 100% Rust.
Stars: ✭ 145 (+119.7%)
Mutual labels:  qrcode, qr-code
Segno
Python QR Code and Micro QR Code encoder
Stars: ✭ 144 (+118.18%)
Mutual labels:  qrcode, qr-code
Instascan
HTML5 QR code scanner using your webcam
Stars: ✭ 2,657 (+3925.76%)
Mutual labels:  qrcode, qr-code
Zxinglite
🔥 ZXing的精简版,优化扫码和生成二维码/条形码,内置闪光灯等功能。扫描风格支持:微信的线条样式,支付宝的网格样式。几句代码轻松拥有扫码功能 ,ZXingLite让集成更简单。(扫码识别速度快如微信)
Stars: ✭ 2,117 (+3107.58%)
Mutual labels:  qrcode, qr-code
kanban-board-app
Kanban style task management board app
Stars: ✭ 118 (+78.79%)
Mutual labels:  qrcode, qr-code
Awesomeqrcode
An awesome QR code generator for Android.
Stars: ✭ 1,718 (+2503.03%)
Mutual labels:  qrcode, qr-code
React Qr Svg
React component for rendering SVG QR codes
Stars: ✭ 134 (+103.03%)
Mutual labels:  qrcode, qr-code
vk-qr
VK QR Code generator library
Stars: ✭ 43 (-34.85%)
Mutual labels:  qrcode, qr-code
LiteNetwork
A simple and fast .NET networking library compatible with .NET Standard 2, .NET 5, 6 and 7.
Stars: ✭ 66 (+0%)
Mutual labels:  dotnet-standard, dotnet-standard2

QR Code Generator for .NET

Open-source library for generating QR codes from text strings and byte arrays.

The library is built for .NET Standard 2.0 and therefore runs on most modern .NET platforms (.NET Core, .NET Framework, Mono etc.) including .NET 6 on all platforms.

It is mostly a translation of Project Nayuki's Java version of the QR code generator. The project provides implementations for many more programming languages, and the Project Nayuki web site has additional information about the implementation.

Features

Core features:

  • Supports encoding all 40 versions (sizes) and all 4 error correction levels, as per the QR Code Model 2 standard
  • Output formats: Raw modules/pixels of the QR symbol, SVG XML string. For raster bitmaps, additional code is provided. See below.
  • Encodes numeric and special-alphanumeric text in less space than general text
  • Open source code under the permissive MIT License
  • Significantly shorter code but more documentation compared to competing libraries
  • Available as a NuGet package (named Net.Codecrete.QrCodeGenerator)

Manual parameters:

  • You can specify the minimum and maximum version number allowed, and the library will automatically choose the smallest version in the range that fits the data.
  • You can specify the mask pattern manually, otherwise library will automatically evaluate all 8 masks and select the optimal one.
  • You can specify an error correction level, or optionally allow the library to boost it if it doesn't increase the version number.
  • You can create a list of data segments manually and add ECI segments.

Optional advanced features:

  • Encodes Japanese Unicode text in Kanji mode to save a lot of space compared to UTF-8 bytes
  • Computes optimal segment mode switching for text with mixed numeric/alphanumeric/general/kanji parts

Getting started

  1. Create a new Visual Studio project for .NET Core 3.1 (or higher) (File > New > Project... / Visual C# > .NET Core > Console App (.NET Core))

  2. Add the library via NuGet:

    Either via Project > Manage NuGet Packages... / Browse / search for qrcodegenerator / Install

    Or by running a command in the Package Manager Console

Install-Package Net.Codecrete.QrCodeGenerator -Version 2.0.1
  1. Add the code from the example below

  2. Run it

API Documention

See API Documentation

Examples

Simple operation

using Net.Codecrete.QrCodeGenerator;

namespace Examples
{
    class SimpleOperation
    {
        static void Main()
        {
            var qr = QrCode.EncodeText("Hello, world!", QrCode.Ecc.Medium);
            string svg = qr.ToSvgString(4);
            File.WriteAllText("hello-world-qr.svg", svg, Encoding.UTF8);
        }
    }
}

Manual operation

using Net.Codecrete.QrCodeGenerator;

namespace Examples
{
    class ManualOperation
    {
        static void Main()
        {
            var segments = QrSegment.MakeSegments("3141592653589793238462643383");
            var qr = QrCode.EncodeSegments(segments, QrCode.Ecc.High, 5, 5, 2, false);
            for (int y = 0; y < qr.Size; y++)
            {
                for (int x = 0; x < qr.Size; x++)
                {
                    ... paint qr.GetModule(x,y) ...
                }
            }
        }
    }
}

Requirements

QR Code Generator for .NET requires a .NET implementation compatible with .NET Standard 2.0 or higher, i.e. any of:

  • .NET Core 2.0 or higher
  • .NET Framework 4.6.1 or higher
  • Mono 5.4 or higher
  • Universal Windows Platform 10.0.16299 or higher
  • Xamarin

Raster Images / Bitmaps

Starting with .NET 6, System.Drawing is only supported on Windows operating system and thus cannot be used for multi-platform libraries like this one. Therefore, ToBitmap() has been removed and three options are now offered in the form of method extensions.

To use it:

  • Select one of the imaging libraries below
  • Add the NuGet dependencies to your project
  • Copy the appropriate QrCodeBitmapExtensions.cs file to your project
Imaging library Recommendation NuGet dependencies Extension file
System.Drawing For Windows only projects System.Drawing.Common QrCodeBitmapExtensions.cs
SkiaSharp For macOS, Linux, iOS, Android and multi-platform projects SkiaSharp and SkiaSharp.NativeAssets.Linux (for Linux only) QrCodeBitmapExtensions.cs
ImageSharp Currently in beta state SixLabors.ImageSharp.Drawing QrCodeBitmapExtensions.cs

Using these extension methods, generating PNG images is straight-forward:

using Net.Codecrete.QrCodeGenerator;

namespace Examples
{
    class PngImage
    {
        static void Main()
        {
            var qr = QrCode.EncodeText("Hello, world!", QrCode.Ecc.Medium);
            qr.SaveAsPng("hello-world-qr.png", 10, 3);
        }
    }
}

Examples

Several example projects are provided:

  • Demo-QRCode-Variety: Demonstrates how QR codes with different encodings, error correction and masks can be generated. All QR codes are saved as SVG files.

  • Demo-WindowsPresentationFoundation: Demonstrates how QR codes can be used in WPF applications (incl. copying to the clipboard).

  • Demo-WinForms: Demonstrates how QR codes can be used in Windows Forms applications (incl. copying to the clipboard).

  • Demo-ASP.NET-Core: Demonstrates how to create QR codes in a web application implemented using ASP.NET Core.

  • Demo-VCard: Demonstrates how contact data (similar to business cards) can be saved in a QR Code using the VCard standard.

  • Demo-System-Drawing: Demonstrates how a QR code can be saved a PNG file, using the System.Drawing classes, which have become a Windows only technology starting with .NET 6.

  • Demo-SkiaSharp: Demonstrates how a QR code can be saved a PNG file, using the SkiaSharp multi-platform raster image library.

  • Demo-ImageSharp: Demonstrates how a QR code can be saved a PNG file, using the ImageSharp raster image library. Additionally, a QR code with an image in the center is created.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].