BarcodeReader.ImageSharp 2.0.1

.NET 5.0 .NET Standard 2.0 .NET Framework 4.7.2
NuGet\Install-Package BarcodeReader.ImageSharp -Version 2.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
dotnet add package BarcodeReader.ImageSharp --version 2.0.1
<PackageReference Include="BarcodeReader.ImageSharp" Version="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BarcodeReader.ImageSharp --version 2.0.1
#r "nuget: BarcodeReader.ImageSharp, 2.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install BarcodeReader.ImageSharp as a Cake Addin
#addin nuget:?package=BarcodeReader.ImageSharp&version=2.0.1

// Install BarcodeReader.ImageSharp as a Cake Tool
#tool nuget:?package=BarcodeReader.ImageSharp&version=2.0.1


Nuget Downloads Build

A barcode reader compatible with SixLabors.ImageSharp using ZXing. Trying to get off System.Drawing.Common.

I created this library specifically to use with blazor but you can totally use this for other use cases!


This is a basic facade-library for the ZXing.Bindings.ImageSharp.V2 library which uses SixLabors.ImageSharp.

Included Features are:

  • Barcode reading functionality that supports all ImageSharp image formats
  • Decode Barcodes synchronously and asynchronously
  • Get rich results from the decoding
  • Fired events for better support in decoding loops

.NET Support

The library supports a vast majority of up-to-date .NET versions:

  • .NET Standard 2.0+
  • .NET Framework 4.7.2
  • .NET Core 3.1+
  • .NET 5+


There are two ways to add the BarcodeReader.ImageSharp library to your projects:

  1. Open the command line and go into the directoy where your .csproj file is located, then execute this command:
dotnet add package BlazorCameraStreamer
  1. Or add it in the GUI of Visual Studio 20XX:
    ToolsNuget Package ManagerManage Nuget Packages for Solution...

Then add the following using to your C# files:

using BarcodeReader.ImageSharp;

And depending on your code, you probably need one or more of the following usings:

using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Formats.Png;

How to Use

In the following code we use one of ImageSharps pixelformats IPixel<Rgba32> which we will use to load PNG images from files.

string path = @"C:\images\qrcode.png";

// first we need to Load a image
Image<Rgba32> image = Image.Load<Rgba32>(path);

// then we create a new BarcodeReader object
BarcodeReader<Rgba32> reader = new BarcodeReader<Rgba32>(types: ZXing.BarcodeFormat.QR_CODE);

// then we can get a result by decoding
BarcodeResult<Rgba32> result = await reader.DecodeAsync(image);

// then we can print out the result
if (result.Status == Status.Found)
else if (result.Status == Status.NotFound)
else if (result.Status == Status.Error)
    Console.WriteLine("An error occured while decoding barcode");

If you're using the reader in a while loop, you can use the DetectedBarcode event to only recieve BarcodeResults with a Status.Found:

// add handler to event
reader.DetectedBarcode += Recieved_Handler;

// infite loop for demonstration purposes
while (true)
    // recieve image from any method (not defined here)
    Image<Rgba32> img = GetNewImage();
    // decode the image. DetectedBarcode events are fired when a barcode could be found
    await reader.DecodeAsync(img);

// handler which is called when a barcode could be detected by any Decode call
void Recieved_Handler(object sender, BarcodeEventArgs<Rgba32> e) { /* Do something with the result */ }
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.1 470 6/26/2022
2.0.0 79 6/24/2022
1.1.1 107 6/23/2022
1.0.0 806 10/27/2021

README added to NuGet package.