ZXingCpp 0.1.2-alpha
See the version list below for details.
dotnet add package ZXingCpp --version 0.1.2-alpha
NuGet\Install-Package ZXingCpp -Version 0.1.2-alpha
<PackageReference Include="ZXingCpp" Version="0.1.2-alpha" />
<PackageVersion Include="ZXingCpp" Version="0.1.2-alpha" />
<PackageReference Include="ZXingCpp" />
paket add ZXingCpp --version 0.1.2-alpha
#r "nuget: ZXingCpp, 0.1.2-alpha"
#:package ZXingCpp@0.1.2-alpha
#addin nuget:?package=ZXingCpp&version=0.1.2-alpha&prerelease
#tool nuget:?package=ZXingCpp&version=0.1.2-alpha&prerelease
ZXingCpp
ZXingCpp is a .NET wrapper for the C++ library zxing-cpp.
It is an open-source, multi-format linear/matrix barcode image processing library implemented in C++. It was originally ported from the Java ZXing Library but has been developed further and now includes many improvements in terms of runtime and detection performance.
Usage
using System.Collections.Generic;
using ImageMagick;
using ZXingCpp;
// BarcodeReader extension class to support direct reading from MagickImage
public static class MagickImageBarcodeReader
{
public static List<Barcode> Read(MagickImage img, ReaderOptions? opts = null)
{
if (img.DetermineBitDepth() < 8)
img.SetBitDepth(8);
var bytes = img.ToByteArray(MagickFormat.Gray);
var iv = new ImageView(bytes, img.Width, img.Height, ImageFormat.Lum);
return BarcodeReader.Read(iv, opts);
}
public static List<Barcode> Read(this BarcodeReader reader, MagickImage img)
=> Read(img, reader);
}
public class Program
{
public static void Main(string[] args)
{
var img = new MagickImage(args[0]);
var reader = new BarcodeReader() {
Formats = BarcodeReader.FormatsFromString(args[1]),
TryInvert = false,
// see the ReaderOptions implementation for more available options
};
foreach (var b in reader.Read(img))
Console.WriteLine($"{b.Format} : {b.Text}");
}
}
To run the code above, it is important that the dotnet runtime finds the native
ZXing[.dll|.so|.dylib]
in your path. E.g. on Linux a complete command line would look like this
LD_LIBRARY_PATH=<ZXing.so-path> dotnet run -- <image-file-name>
Note: This is an alpha release, meaning the API may still change slightly to feel even more "managed" depending on community feedback.
Benchmarking
To compare the performance of this .NET wrapper project with other available barcode scanner .NET libraries, I started the project zxing-bench. The README contains a few results to get an idea.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on ZXingCpp:
Repository | Stars |
---|---|
afriscic/BarcodeScanning.Native.Maui
Barcode scanning library for .NET MAUI
|
Version | Downloads | Last Updated |
---|---|---|
0.4.0-alpha | 2,299 | 1/4/2025 |
0.3.0-alpha | 205 | 11/5/2024 |
0.2.2-alpha | 1,452 | 9/8/2024 |
0.2.1-alpha | 808 | 3/21/2024 |
0.2.0-alpha | 92 | 3/21/2024 |
0.1.3-alpha | 569 | 2/3/2024 |
0.1.2-alpha | 75 | 2/2/2024 |
0.1.1-alpha | 84 | 1/31/2024 |
0.1.0-alpha | 83 | 1/30/2024 |