CodeGlyphX
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.
Install / Use
/learn @EvotecIT/CodeGlyphXREADME
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
🛠️ Project Information
👨💻 Author & Social
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 / WebP / GIF / TIFF / BMP / PPM / PBM / PGM / PAM / XBM / XPM / TGA / ICO / PDF / EPS / ASCII) and image decoding (PNG/JPEG/WebP/GIF/BMP/PPM/PBM/PGM/PAM/XBM/XPM/TGA/ICO/TIFF, plus limited PSD/PDF)
- 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, email/phone/SMS, contacts, calendar, payments, crypto, social, OTP)
- Friendly APIs: one-liners + options + fluent presets
Security & Safe Usage
When decoding untrusted images, use explicit limits via ImageDecodeOptions (recommended presets: Safe() / UltraSafe()) and pass them to ImageReader or QrImageDecoder. Global defaults (ImageReader.MaxImageBytes, ImageReader.MaxPixels) are set to conservative values, but you should tune them for your environment.
var safe = ImageDecodeOptions.UltraSafe(maxBytes: 8 * 1024 * 1024, maxPixels: 8_000_000);
var rgba = ImageReader.DecodeRgba32(bytes, safe, out var width, out var height);
Convenience helpers: ImageReader.DecodeRgba32Safe / TryDecodeRgba32Safe apply safe defaults for untrusted inputs.
See SECURITY.md for reporting guidance and FUZZING.md for the decoder fuzzing harness.
Roadmap & Website
- Roadmap:
ROADMAP.md - Benchmarks:
BENCHMARK.md - Website docs:
WEBSITE.md
Installation
dotnet add package CodeGlyphX
Examples
Run all examples:
dotnet run --project CodeGlyphX.Examples
Outputs land under CodeGlyphX.Examples/bin/<TFM>/Examples.
Targeted runs (set one env var at a time):
CODEGLYPHX_DIAG_QR=1- QR diagnosticsCODEGLYPHX_DECODE_HARD_ART=1- hard art diagnosticsCODEGLYPHX_DECODE_SAMPLES=1- decode sample sweepCODEGLYPHX_MODULE_DIFF=1- module diff renderCODEGLYPHX_SCREENSHOT_WALKTHROUGH=1- screenshot decode walkthrough
Target Framework Feature Matrix
CodeGlyphX targets netstandard2.0, net472, net8.0, and net10.0. Most features are available everywhere, but the full 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 | ✅ | ⚠️ Best-effort fallback (clean/generated images) | | QR pixel debug rendering | ✅ | ✖ | | Span-based overloads | ✅ | ✖ (byte[] only) |
Notes:
netstandard2.0andnet472requireSystem.Memory4.5.5 (automatically pulled by NuGet).- net8+ uses the full QR pixel pipeline;
net472/netstandard2.0use a best-effort fallback for QR image decode viaQrImageDecoderand byte[] overloads. - Runtime checks are available via
CodeGlyphXFeatures(e.g.,SupportsQrPixelDecode,SupportsQrPixelDecodeFallback,SupportsQrPixelDebug).
net472 capability notes (QR from images):
- ✅ Clean/generated PNG/JPEG QR renders (including large module sizes)
- ⚠️ Multi-code screenshots, heavy styling/art, blur, warp, and low-contrast scenes are best-effort
- ✅ Recommended: run the quick smoke checklist in
Build/Net472-SmokeTest.md
Recommended pattern for shared code:
if (CodeGlyphXFeatures.SupportsQrPixelDecode &&
QrImageDecoder.TryDecodeImage(bytes, QrPixelDecodeOptions.Screen(), out var decoded))
{
Console.WriteLine(decoded.Text);
}
else
{
// net472 fallback: decode from module grids or run QR pixel decode on a net8+ worker.
}
Choosing a target:
- Pick
net8.0/net10.0when you need the most robust QR pixel decode from images/screenshots, pixel debug rendering, Span APIs, or maximum throughput. - Pick
net472/netstandard2.0for legacy apps; QR image decode is available via a best-effort fallback, but it is less robust on heavily styled/artistic inputs.
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);
}
Screenshot decode preset:
var imageOptions = ImageDecodeOptions.Screen(maxMilliseconds: 600, maxDimension: 1400);
var qrOptions = QrPixelDecodeOptions.Screen(maxMilliseconds: 600, maxDimension: 1400);
qrOptions.EnableTileScan = true;
qrOptions.TileGrid = 3;
if (QrImageDecoder.TryDecodeImage(bytes, imageOptions, out var decoded, out var info, qrOptions)) {
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/WebP/GIF/TIFF/BMP/PPM/PBM/PGM/PAM/XBM/XPM/TGA/ICO/PDF/EPS/ASCII) | ✅ | ✅ | ✅ | | Image decoding (PNG/JPEG/WebP/GIF/BMP/PPM/PBM/PGM/PAM/XBM/XPM/TGA/ICO/TIFF/PSD/PDF) | ✅ | ✅ | ✅ | | 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).
This README intentionally does not mirror benchmark tables to avoid drift. See BENCHMARK.md for the latest Windows/Linux/macOS quick and full runs, including timestamps and hardware details.
Quick runs use fewer iterations but include the sam
