Skip to content

CodeGlyphX is a fast, dependency-free toolkit for QR codes and barcodes, with robust decoding and a minimal API. It targets modern .NET as well as legacy .NET Framework, and includes renderers, payload helpers, and WPF controls.

License

Notifications You must be signed in to change notification settings

EvotecIT/CodeGlyphX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeGlyphX - No-deps QR & Barcode Toolkit for .NET

CodeGlyphX is a fast, dependency-free toolkit for QR codes and barcodes, with robust decoding and a minimal API. It targets modern .NET as well as legacy .NET Framework, and includes renderers, payload helpers, and WPF controls.

Status: Actively developed · Stable core · Expanding format support

📦 NuGet Package

nuget downloads nuget version

🛠️ Project Information

top language license build codecov

👨‍💻 Author & Social

Twitter follow Blog LinkedIn Threads Discord

What it's all about

CodeGlyphX is a no-deps QR + barcode toolkit for .NET with:

  • Reliable QR decoding (ECI, FNC1/GS1, Kanji, structured append, Micro QR)
  • 1D barcode encoding/decoding (Code128/GS1-128, Code39, Code93, Code11, Codabar, MSI, Plessey, EAN/UPC, ITF-14)
  • 2D encoding/decoding (Data Matrix, MicroPDF417, PDF417, Aztec)
  • Renderers (SVG / SVGZ / HTML / PNG / JPEG / BMP / PPM / PBM / PGM / PAM / XBM / XPM / TGA / ICO / PDF / EPS / ASCII) and image decoding (PNG/JPEG/GIF/BMP/PPM/PBM/PGM/PAM/XBM/XPM/TGA/ICO/TIFF)
  • OTP helpers (otpauth://totp + Base32)
  • WPF controls + demo apps

Highlights

  • Zero external dependencies (no System.Drawing, no SkiaSharp, no ImageSharp)
  • Encode + decode for QR/Micro QR + common 1D/2D symbologies
  • Robust pixel decoder for screenshots, gradients, low-contrast, rotation/mirroring
  • Payload helpers for QR (WiFi, payments, contacts, OTP, social, etc.)
  • Friendly APIs: one-liners + options + fluent presets

Roadmap & Website

  • Roadmap: ROADMAP.md

Installation

dotnet add package CodeGlyphX

Target Framework Feature Matrix

CodeGlyphX targets netstandard2.0, net472, net8.0, and net10.0. Most features are available everywhere, but the QR pixel pipeline and Span-based APIs are net8+ only.

Feature net8.0 / net10.0 net472 / netstandard2.0
Encode (QR/Micro QR + 1D/2D symbologies) âś… âś…
Decode from module grids (BitMatrix) âś… âś…
Renderers + image file codecs (PNG/JPEG/SVG/PDF/etc) âś… âś…
1D/2D pixel decode (Barcode/DataMatrix/PDF417/Aztec) âś… âś…
QR pixel decode from raw pixels / screenshots ✅ ⚠️ Not available (returns false)
QR pixel debug rendering âś… âś–
Span-based overloads âś… âś– (byte[] only)

Notes:

  • netstandard2.0 and net472 require System.Memory 4.5.5 (automatically pulled by NuGet).
  • QrImageDecoder.TryDecodeImage(...) and QrDecoder.TryDecode(...) from pixels are net8+ only.
  • Runtime checks are available via CodeGlyphXFeatures (e.g., SupportsQrPixelDecode, SupportsQrPixelDebug).

Choosing a target:

  • Pick net8.0/net10.0 when you need QR pixel decode from images/screenshots, pixel debug rendering, Span APIs, or maximum throughput.
  • Pick net472/netstandard2.0 for legacy apps that only need encoding, rendering, and module-grid decode (QR pixel decode from images is unavailable).

Decode (unified)

using CodeGlyphX;
using CodeGlyphX.Rendering;

var options = new CodeGlyphDecodeOptions {
    PreferBarcode = false,
    Qr = new QrPixelDecodeOptions {
        Profile = QrDecodeProfile.Robust,
        MaxMilliseconds = 800
    }
};

if (CodeGlyph.TryDecode(pixels, width, height, stride, PixelFormat.Rgba32, out var decoded, options)) {
    Console.WriteLine($"{decoded.Kind}: {decoded.Text}");
}

Diagnostics:

if (!CodeGlyph.TryDecode(pixels, width, height, stride, PixelFormat.Rgba32, out var decoded, out var diagnostics, options)) {
    Console.WriteLine(diagnostics.FailureReason);
    Console.WriteLine(diagnostics.Failure);
}

Presets for easy tuning:

var fast = CodeGlyphDecodeOptions.Fast();
var robust = CodeGlyphDecodeOptions.Robust();
var stylized = CodeGlyphDecodeOptions.Stylized();
var screen = CodeGlyphDecodeOptions.Screen(maxMilliseconds: 300, maxDimension: 1200);

Barcode checksum policy:

var options = new CodeGlyphDecodeOptions {
    ExpectedBarcode = BarcodeType.Code39,
    Code39Checksum = Code39ChecksumPolicy.StripIfValid,
    PreferBarcode = true
};

Cancellation and time budget:

using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(500));

var options = new CodeGlyphDecodeOptions {
    Qr = new QrPixelDecodeOptions { Profile = QrDecodeProfile.Robust },
    CancellationToken = cts.Token
};

if (CodeGlyph.TryDecode(pixels, width, height, stride, PixelFormat.Rgba32, out var decoded, options)) {
    Console.WriteLine(decoded.Text);
}

Screen-friendly preset:

var options = CodeGlyphDecodeOptions.Screen(maxMilliseconds: 300, maxDimension: 1200);
if (CodeGlyph.TryDecode(pixels, width, height, stride, PixelFormat.Rgba32, out var decoded, options)) {
    Console.WriteLine(decoded.Text);
}

Supported .NET Versions and Dependencies

Core Library (CodeGlyphX)

  • .NET 10 / .NET 8 (Windows, Linux, macOS)
    • No external dependencies
  • .NET Standard 2.0 (Cross-platform compatibility)
    • System.Memory (4.5.5)
  • .NET Framework 4.7.2 (Windows only)
    • System.Memory (4.5.5)

Examples Project

  • .NET 8.0 only

WPF Projects

  • .NET 8.0 (windows) only

Platform support (at a glance)

Runs wherever .NET runs (Windows, Linux, macOS). WPF controls are Windows-only.

Feature Windows Linux macOS
Core encode/decode (QR/1D/2D) âś… âś… âś…
Renderers (PNG/SVG/SVGZ/HTML/JPEG/BMP/PPM/PBM/PGM/PAM/XBM/XPM/TGA/ICO/PDF/EPS/ASCII) âś… âś… âś…
Image decoding (PNG/JPEG/GIF/BMP/PPM/PBM/PGM/PAM/XBM/XPM/TGA/ICO/TIFF) âś… âś… âś…
WPF controls ✅ ❌ ❌

Build Status

Cross-Platform Testing: Builds and tests run on Windows, Linux, and macOS. Windows additionally builds WPF and .NET Framework targets.

Benchmarks (local run)

Latest benchmark tables are generated into BENCHMARK.md (and Assets/Data/benchmark*.json). Benchmarks below were run on 2026-01-19 (Linux Ubuntu 24.04, Ryzen 9 9950X, .NET 8.0.22). Your results will vary. Benchmarks run on identical hardware with default settings. Quick runs use fewer iterations but include the same scenario list as full runs.

QR (Encode)

Scenario Mean (us) Allocated
QR PNG (short text) 331.33 431.94 KB
QR PNG (medium text) 713.68 837.75 KB
QR PNG (long text) 2197.99 3041.06 KB
QR SVG (medium text) 99.17 20.03 KB
QR PNG (High EC) 1094.94 1535.88 KB
QR HTML (medium text) 115.46 137.43 KB

QR (Decode)

Scenario Mean (ms) Allocated Notes
QR decode (clean, fast) 2.148 103.9 KB qr-clean-small.png
QR decode (clean, balanced) 2.124 103.9 KB qr-clean-small.png
QR decode (clean, robust) 2.193 103.9 KB qr-clean-small.png
QR decode (noisy, robust) 170.949 8507.41 KB qr-noisy-ui.png (Robust, MaxMilliseconds=800)

1D Barcodes (Encode)

Scenario Mean (us) Allocated
Code 128 PNG 442.41 756.24 KB
Code 128 SVG 2.52 17.61 KB
EAN PNG 191.33 338.54 KB
Code 39 PNG 311.37 414.49 KB
Code 93 PNG 222.69 367.76 KB
UPC-A PNG 175.83 338.85 KB

2D Matrix Codes (Encode)

Scenario Mean (us) Allocated
Data Matrix PNG (medium) 303.48 447.73 KB
Data Matrix PNG (long) 711.93 1509.06 KB
Data Matrix SVG 5.64 12.29 KB
PDF417 PNG 1730.92 3154.87 KB
PDF417 SVG 28.79 64.53 KB
Aztec PNG 260.70 452.30 KB
Aztec SVG 12.76 59.74 KB

Performance checklist

Environment

  • Close heavy apps (indexers, browsers, video calls).
  • Use AC power and High Performance plan; avoid battery saver.
  • Reboot if the system has been running for a long time.

Build & preflight

  • dotnet --info (record SDK + runtime versions).
  • dotnet build CodeGlyphX.sln
  • dotnet run -c Release --project CodeGlyphX.Benchmarks -- --preflight

Quick run (sanity)

  • bash Build/run-benchmarks-compare.sh --no-compare --base-filter '*QrDecode*'
  • Generate report:
    • python3 Build/generate-benchmark-report.py --artifacts-path <artifacts> --framework net8.0 --configuration Release --run-mode quick

Full run (publishable)

  • bash Build/run-benchmarks-compare.sh
  • Generate report:
    • python3 Build/generate-benchmark-report.py --artifacts-path <artifacts> --framework net8.0 --configuration Release --run-mode full

Regression triage

  • Re-run the same filter twice to confirm regressions.
  • Use QR diagnostics knobs if needed:
    • CODEGLYPHX_DIAG_QR_MAXMS, CODEGLYPHX_DIAG_QR_AGG, CODEGLYPHX_DIAG_QR_DISABLE_TRANSFORMS
  • Capture before/after benchmark tables in the PR summary.

Docs/artifacts

  • Update BENCHMARK.md and Assets/Data/benchmark*.json.
  • If public API docs changed, regenerate website docs: pwsh Build/Build-Website.ps1.

Run benchmarks

dotnet run -c Release --framework net8.0 --project CodeGlyphX.Benchmarks/CodeGlyphX.Benchmarks.csproj -- --filter "*"

Run comparison benchmarks (external libraries)

Comparison benchmarks are opt-in so the default benchmark project stays dependency-free. Enable them with MSBuild properties:

# all external comparisons
dotnet run -c Release --framework net8.0 --project CodeGlyphX.Benchmarks/CodeGlyphX.Benchmarks.csproj /p:CompareExternal=true -- --filter "*Compare*"

# per-library toggles
dotnet run -c Release --framework net8.0 --project CodeGlyphX.Benchmarks/CodeGlyphX.Benchmarks.csproj /p:CompareZXing=true -- --filter "*Compare*"
dotnet run -c Release --framework net8.0 --project CodeGlyphX.Benchmarks/CodeGlyphX.Benchmarks.csproj /p:CompareQRCoder=true -- --filter "*Compare*"
dotnet run -c Release --framework net8.0 --project CodeGlyphX.Benchmarks/CodeGlyphX.Benchmarks.csproj /p:CompareBarcoder=true -- --filter "*Compare*"

Notes:

  • Comparisons target PNG output and use each library’s ImageSharp-based renderer where applicable.
  • Run the same command on Windows and Linux to compare OS-level differences.

Comparison (selected libraries)

Based on public docs as of 2026-01-18. Capabilities depend on optional renderer packages.

Library Encode Decode 2D Codes 1D Codes Image Dependencies
CodeGlyphX âś… âś… QR, Micro QR, Data Matrix, MicroPDF417, PDF417, Aztec âś… None (built-in PNG/JPEG/GIF/BMP/PPM/PBM/PGM/PAM/XBM/XPM/TGA/ICO/TIFF decode)
ZXing.Net âś… âś… QR, Data Matrix, PDF417, Aztec, more âś… Image I/O via bindings on .NET Standard/5+; System.Drawing on full .NET Framework
QRCoder ✅ ❌ QR only ❌ System.Drawing renderer (Windows) or alt renderers
Barcoder ✅ ❌ QR, Data Matrix, PDF417, Aztec ✅ ImageSharp.Drawing for image renderer

Supported Symbologies

Symbology Encode Decode Outputs Notes
QR âś… âś… All (see Output formats) ECI, FNC1/GS1, Kanji, structured append
Micro QR ✅ ✅ All (see Output formats) Versions M1–M4
Code128 âś… âś… All (see Output formats) Set A/B/C
GS1-128 âś… âś… All (see Output formats) FNC1 + AI helpers
Code39 âś… âś… All (see Output formats) Optional checksum
Code93 âś… âś… All (see Output formats) Optional checksum
Code11 âś… âś… All (see Output formats) Optional checksum
Codabar âś… âś… All (see Output formats) A/B/C/D start/stop
MSI âś… âś… All (see Output formats) Mod10 / Mod10Mod10
Plessey âś… âś… All (see Output formats) CRC
Telepen âś… âś… All (see Output formats) ASCII 0-127, checksum
Pharmacode (one-track) ✅ ✅ All (see Output formats) Numeric 3–131070
Pharmacode (two-track) ✅ ✅ All (see Output formats) Matrix renderers (top/bottom/full bars), numeric 4–64570080
Code 32 (Italian Pharmacode) âś… âś… All (see Output formats) 8 digits + checksum
POSTNET / PLANET âś… âś… All (see Output formats) Matrix renderers (tall/short bars), checksum
KIX / Royal Mail 4-State âś… âś… All (see Output formats) KIX (headerless) + RM4SCC (headers + checksum), matrix renderers
Australia Post (Customer) âś… âś… All (see Output formats) Standard + Customer 2/3, RS parity (ambiguous N/C decode for numeric-only Customer 3)
Japan Post âś… âś… All (see Output formats) 67-bar 4-state, modulo-19 check
USPS Intelligent Mail (IMB) âś… âś… All (see Output formats) 65-bar 4-state, tracking + routing (5/9/11)
GS1 DataBar-14 Truncated âś… âś… All (see Output formats) GTIN-13 input (check digit computed)
GS1 DataBar-14 Omnidirectional âś… âś… All (see Output formats) Matrix renderers
GS1 DataBar-14 Stacked âś… âś… All (see Output formats) Matrix renderers
GS1 DataBar Expanded âś… âś… All (see Output formats) GS1 AI strings (linear)
GS1 DataBar Expanded Stacked âś… âś… All (see Output formats) Matrix renderers
EAN-8 / EAN-13 âś… âś… All (see Output formats) Checksum validation, +2/+5 add-ons
UPC-A / UPC-E âś… âś… All (see Output formats) Checksum validation, +2/+5 add-ons
ITF-14 âś… âś… All (see Output formats) Checksum validation
ITF (Interleaved 2 of 5) âś… âś… All (see Output formats) Even-length digits, optional checksum
Industrial 2 of 5 âś… âś… All (see Output formats) Optional checksum
Matrix 2 of 5 âś… âś… All (see Output formats) Optional checksum
IATA 2 of 5 âś… âś… All (see Output formats) Optional checksum
Patch Code âś… âś… All (see Output formats) Single symbol (1,2,3,4,6,T)
Data Matrix âś… âś… All (see Output formats) ASCII/C40/Text/X12/EDIFACT/Base256
MicroPDF417 âś… âś… All (see Output formats) Module matrix encode/decode
PDF417 âś… âś… All (see Output formats) Full encode/decode, Macro PDF417 metadata
Aztec âś… âś… All (see Output formats) Module matrix + basic pixel decode

Features

  • QR encode + robust decode
  • Micro QR support
  • 1D barcode encode + decode
  • Data Matrix + MicroPDF417 + PDF417 encode + decode
  • Matrix barcode encoding (Data Matrix / MicroPDF417 / PDF417 / KIX / GS1 DataBar) with dedicated matrix renderers
  • SVG / SVGZ / HTML / PNG / JPEG / BMP / PPM / PBM / PGM / PAM / XBM / XPM / TGA / ICO / PDF / EPS / ASCII renderers
  • Image decode: PNG / JPEG / GIF / BMP / PPM / PBM / PGM / PAM / XBM / XPM / TGA / ICO / TIFF
  • Base64 + data URI helpers for rendered outputs
  • Payload helpers (URL, WiFi, Email, Phone, SMS, Contact, Calendar, OTP, Social)
  • WPF controls and demo apps
  • Aztec encode + decode (module matrix + pixel)
  • Aztec render helpers (PNG/SVG/SVGZ/HTML/JPEG/BMP/PPM/PBM/PGM/PAM/XBM/XPM/TGA/ICO/PDF/EPS/ASCII + Save by extension)

AOT & trimming

CodeGlyphX is AOT-friendly (no reflection, no runtime codegen) and ships with trimming/AOT analyzers enabled for .NET 8+ targets. Recommended publish flags: PublishAot=true (native), or PublishTrimmed=true (size) for app projects.

Output formats (Save by extension)

Save(...) chooses the output based on file extension for QR/Barcode/DataMatrix/PDF417/Aztec. For other matrix barcodes (e.g., KIX/Royal Mail 4‑State), use the Matrix* renderers with a BitMatrix from MatrixBarcodeEncoder.

Format Extensions Notes
PNG .png Raster
JPEG .jpg, .jpeg Raster, quality via options
BMP .bmp Raster
PPM .ppm Raster (portable pixmap)
PBM .pbm Raster (portable bitmap)
PGM .pgm Raster (portable graymap)
PAM .pam Raster (portable anymap, RGBA)
XBM .xbm Text (1-bit)
XPM .xpm Text (2-color)
TGA .tga Raster
ICO .ico Raster (PNG inside, multi-size by default)
SVG .svg Vector
SVGZ .svgz, .svg.gz Vector (gzip-compressed SVG)
HTML .html, .htm Table-based output
PDF .pdf Vector by default, raster via RenderMode
EPS .eps, .ps Vector by default, raster via RenderMode
ASCII API only Use RenderAscii methods
Raw RGBA API only Use RenderPixels methods

ICO multi-size

using CodeGlyphX;

var opts = new QrEasyOptions {
    IcoSizes = new[] { 32, 64, 128 },
    IcoPreserveAspectRatio = true
};
QR.Save("https://example.com", "qr.ico", opts);

Payload helpers

QR payload helpers generate well-known structured strings so scanners can trigger the right action.

Category Payloads
Core Text, URL, Bookmark, WiFi
Communication Email (Mailto/MATMSG/SMTP), Phone, SMS, MMS, Skype
Location & Calendar Geo, Calendar (iCal/vEvent)
Contacts vCard / MeCard
OTP TOTP / HOTP (otpauth://)
Social & Stores App Store (Apple/Google), Facebook, X/Twitter, TikTok, LinkedIn, WhatsApp
Payments UPI, SEPA Girocode (EPC), BezahlCode (contact/payment/debit/periodic), Swiss QR Bill, Slovenian UPN, Russia Payment Order (ST00012)
Crypto & Network Bitcoin / Bitcoin Cash / Litecoin, Monero, ShadowSocks

Image format support

Raster formats (encode + decode)

Format Encode Decode Notes
PNG âś… âś… Color types 0/2/3/4/6, bit depths 1/2/4/8/16, tRNS, Adam7
JPEG âś… âś… Baseline + progressive (8-bit, Huffman), EXIF orientation, CMYK/YCCK
BMP âś… âś… 1/4/8/16/24/32-bit, RLE4/RLE8, bitfields
GIF No âś… First frame only, transparency via GCE
TIFF No âś… Baseline, strips, uncompressed/PackBits/LZW/Deflate, 8/16-bit, predictor 2
PPM/PGM/PAM/PBM âś… âś… Portable pixmaps (8/16-bit maxval, PAM RGBA)
TGA âś… âś… Uncompressed + RLE, true-color/grayscale/color-mapped
ICO/CUR âś… âś… Multi-size icons (PNG/BMP payloads)
XBM/XPM âś… âś… X Window text formats

Vector / text outputs (encode only)

Format Encode Notes
SVG / SVGZ âś… Vector output
PDF / EPS âś… Vector by default, raster via RenderMode
HTML âś… Table-based output
ASCII âś… API only
Raw RGBA âś… Use RenderPixels APIs

Known gaps / not supported (decode)

  • WebP, AVIF, HEIC, JPEG2000, PSD
  • Animated GIF (first frame only)
  • Multi-page / tiled TIFF, mixed sample sizes, 12-bit JPEG
  • PDF/PS decode (rasterize first)

Format corpus (optional)

  • Image format corpus: CodeGlyphX.Tests/Fixtures/ImageSamples/manifest.json
    Download with pwsh Build/Download-ImageSamples.ps1 (or set CODEGLYPHX_IMAGE_SAMPLES).
  • External barcode/QR samples: CodeGlyphX.Tests/Fixtures/ExternalSamples/manifest.json
    Download with pwsh Build/Download-ExternalSamples.ps1 (or set CODEGLYPHX_EXTERNAL_SAMPLES).

Quick usage

using CodeGlyphX;

QR.Save("https://example.com", "qr.png");
QR.Save("https://example.com", "qr.svg");
QR.Save("https://example.com", "qr.jpg");
QR.Save("https://example.com", "qr.pdf");
using CodeGlyphX;

// Simple styling (colored eyes + rounded modules)
var opts = new QrEasyOptions {
    ModuleShape = QrPngModuleShape.Rounded,
    ModuleCornerRadiusPx = 3,
    Eyes = new QrPngEyeOptions {
        UseFrame = true,
        OuterShape = QrPngModuleShape.Circle,
        InnerShape = QrPngModuleShape.Circle,
        OuterColor = new Rgba32(220, 20, 60),
        InnerColor = new Rgba32(220, 20, 60),
    }
};
QR.Save("https://example.com", "qr-styled.png", opts);
using CodeGlyphX;
using CodeGlyphX.Rendering;

// PDF/EPS are vector by default. Use Raster when you need pixels.
QR.SavePdf("https://example.com", "qr-raster.pdf", mode: RenderMode.Raster);

Notes:

  • Vector PDF/EPS support square/rounded/circle modules and eye shapes.
  • Gradients and logos automatically fall back to raster to preserve appearance.
  • PDF/EPS are output-only. For decoding, rasterize to PNG/BMP/PPM/PBM/PGM/PAM/TGA and use the image decoders.
  • Logo background plates auto-bump the minimum QR version to 8 by default for scan safety (disable with AutoBumpVersionForLogoBackground or set LogoBackgroundMinVersion = 0).
using CodeGlyphX;

Barcode.Save(BarcodeType.Code128, "CODE128-12345", "code128.png");
Barcode.Save(BarcodeType.Code128, "CODE128-12345", "code128.pdf");
Barcode.Save(BarcodeType.Code128, "CODE128-12345", "code128.eps");
using CodeGlyphX;

// One-liners with defaults
var png = BarcodeEasy.RenderPng(BarcodeType.Code128, "CODE128-12345");
using CodeGlyphX;

DataMatrixCode.Save("DataMatrix-12345", "datamatrix.png");
DataMatrixCode.Save("DataMatrix-12345", "datamatrix.pdf");
DataMatrixCode.Save("DataMatrix-12345", "datamatrix.eps");
Pdf417Code.Save("PDF417-12345", "pdf417.png");
Pdf417Code.Save("PDF417-12345", "pdf417.pdf");
Pdf417Code.Save("PDF417-12345", "pdf417.eps");

Payload helpers (3 lines each)

using CodeGlyphX;
using CodeGlyphX.Payloads;

QR.Save(QrPayloads.Url("https://example.com"), "url.png");
QR.Save(QrPayloads.Wifi("MyWiFi", "p@ssw0rd"), "wifi.png");
QR.Save(QrPayloads.OneTimePassword(OtpAuthType.Totp, "JBSWY3DPEHPK3PXP", label: "[email protected]", issuer: "AuthIMO"), "otp.png");

Decode (pixels or images)

using CodeGlyphX;

if (QrImageDecoder.TryDecodeImage(File.ReadAllBytes("code.bmp"), out var decoded)) {
    Console.WriteLine(decoded.Text);
}
using CodeGlyphX;

var options = QrPixelDecodeOptions.Fast();
if (QrImageDecoder.TryDecodeImage(File.ReadAllBytes("screen.png"), options, out var decoded)) {
    Console.WriteLine(decoded.Text);
}
using CodeGlyphX;

var options = QrPixelDecodeOptions.Screen(maxMilliseconds: 300, maxDimension: 1200);
if (QrImageDecoder.TryDecodeImage(File.ReadAllBytes("screen.png"), options, out var decoded)) {
    Console.WriteLine(decoded.Text);
}
using CodeGlyphX;

var bytes = File.ReadAllBytes("screen.png");
if (QR.TryDecodeImage(bytes, QrPixelDecodeOptions.Screen(), out var decoded)) {
    Console.WriteLine(decoded.Text);
}
using CodeGlyphX;

if (!QrImageDecoder.TryDecodeImage(File.ReadAllBytes("screen.png"), out var decoded, out var info)) {
    QrDiagnosticsDump.WriteText("decode-diagnostics.txt", info, source: "screen.png");
}
using CodeGlyphX;

if (CodeGlyph.TryDecodeAllPng(File.ReadAllBytes("unknown.png"), out var results)) {
    foreach (var item in results) Console.WriteLine($"{item.Kind}: {item.Text}");
}

Decode (3 lines each)

using CodeGlyphX;

if (Barcode.TryDecodeImage(File.ReadAllBytes("code.png"), BarcodeType.Code128, out var barcode))
    Console.WriteLine(barcode.Text);
using CodeGlyphX;

if (DataMatrixCode.TryDecodeImage(File.ReadAllBytes("dm.png"), out var text))
    Console.WriteLine(text);
using CodeGlyphX;

if (Pdf417Code.TryDecodeImage(File.ReadAllBytes("pdf417.png"), out var text))
    Console.WriteLine(text);
using CodeGlyphX;

if (AztecCode.TryDecodeImage(File.ReadAllBytes("aztec.png"), out var text))
    Console.WriteLine(text);
using CodeGlyphX;

var opts = ImageDecodeOptions.Screen(maxMilliseconds: 300, maxDimension: 1200);
Barcode.TryDecodePng(File.ReadAllBytes("barcode.png"), BarcodeType.Code128, opts, out var barcode);

WPF controls

xmlns:wpf="clr-namespace:CodeGlyphX.Wpf;assembly=CodeGlyphX.Wpf"
<wpf:QrCodeControl Text="{Binding QrText}" Ecc="M" ModuleSize="6" QuietZone="4" />
<wpf:Barcode128Control Value="{Binding BarcodeValue}" ModuleSize="2" QuietZone="10" />

License

Apache-2.0.

About

CodeGlyphX is a fast, dependency-free toolkit for QR codes and barcodes, with robust decoding and a minimal API. It targets modern .NET as well as legacy .NET Framework, and includes renderers, payload helpers, and WPF controls.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •