TesserNet.ImageSharp 0.7.0

.NET Standard 2.0
Install-Package TesserNet.ImageSharp -Version 0.7.0
dotnet add package TesserNet.ImageSharp --version 0.7.0
<PackageReference Include="TesserNet.ImageSharp" Version="0.7.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TesserNet.ImageSharp --version 0.7.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TesserNet.ImageSharp, 0.7.0"
#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 TesserNet.ImageSharp as a Cake Addin
#addin nuget:?package=TesserNet.ImageSharp&version=0.7.0

// Install TesserNet.ImageSharp as a Cake Tool
#tool nuget:?package=TesserNet.ImageSharp&version=0.7.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

NuGet
<a href="https://www.buymeacoffee.com/cptwesley" target="_blank"><img src="https://shields.io/badge/Support%20Me-Buy%20Me%20A%20Coffee-yellow?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAgCAYAAAAWl4iLAAAGBnpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjarVdbkuQqDv1nFbMEQAjBcngpYnYwy58jjF2ZVdl9+84dO9JgLPQ6epBu/eff6v6FK4YQXWIpuebscaWaamyYFH9d1xh82s/rJZ9v4X3dxbPuI5YII12veR36hnX+2iDprPf3dSfj8CmHUXgY74tMss0PXTmMKF7r4by7eva19GLO+cVx2B7m39+TwBmTwY+ii4sCeTyTSSH7BWr42RP6xHuF8dYwj59957r/7Lxn9s13vp11eneF8zcK+ZuPznrgb+v0iIlvGoUvyW8fEAbiX68X36nOorou61rK8FR2x6jblD0DISxOtLdl3IIfYy77rrgLTBxAbALNjnu4UEOEtzWkMEMLGtYeRxhQMcUVBWOMAx63tUISaxwGAyW7g0ahStNRARIDqBGW46NL2HLrljdCgeQZQIlkGJAbf97u0+L/cj+MVC10Q/Dl8lPfAEeLGqhhyNkTVAAk6PEpb//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9tCAOMDppkgghOVzfUUoYCwAXqS8LH7a3+3fVGQvJ4SIefXJSguQqKwKjk94ng9qi+ZQMhj9Q11rCLVHTY7G87YKWYujlOVL8PY3qsq7LmtMxaDF1XVvQTmxosSsonR5JSygkR3+IERwziY90CDZhDGMror/18UHsJtaEPFtNnEEsJb93tYKd51fpKIc9hr51Kx7m+MIP/XP0sXtt5p5aoTWL2mszi/hHrmKnQEjRFxqSbKOQh5B1AAAAAElFTkSuQmCC" alt="Buy Me A Coffee" ></a>

TesserNet

TesserNet provides high level bindings for Tesseract in .NET. The library comes with all required native libraries and a trained English model, meaning you don't need any additional setup to get the library up and running! Additionally, the library provides a simple Tesseract instance pooling system (through the TesseractPool class) so you can carelessly make asynchronous OCR invocations.

Limitations

Windows is currently the only version that doesn't require installing extra dependencies. For Linux distributions it is necessary to install tesseract-ocr. For distributions that use apt as the package manager (e.g. Ubuntu, Debian, Raspbian) this can be done using sudo apt-get install tesseract-ocr. Linux support is new and experimental. Problems might arise due to tesseract-ocr not being available or because the found version is too old. iOS is currently not yet supported.

Downloads

TesserNet
TesserNet for System.Drawing
TesserNet for ImageSharp
TesserNet for SkiaSharp

License

This product includes Leptonica, which is available under a "BSD 2-clause" license.
This product includes Tesseract, which is available under a "Apache Version 2.0" license.

Usage

When using on Linux, make sure tesseract-ocr has been installed on your system.

There are a few example project available for you to try out in the src directory. Note that the TesserNet.Example.System.Drawing example uses .NET Framework, meaning it will only run on Windows.

To start off, one first needs to add the following import:

using TesserNet;

One can then create a Tesseract instace:

Tesseract tesseract = new Tesseract();

With that instance one can now perform OCR.

string result = tesseract.Read(...);

By default, the following Read methods are provided:

string Read(byte[] data, int width, int height, int bytesPerPixel);
string Read(byte[] data, int width, int height, int bytesPerPixel, int rectX, int rectY, int rectWidth, int rectHeight);
Task<string> ReadAsync(byte[] data, int width, int height, int bytesPerPixel);
Task<string> ReadAsync(byte[] data, int width, int height, int bytesPerPixel, int rectX, int rectY, int rectWidth, int rectHeight);

Additionally, if one prefers to use System.Drawing, ImageSharp or SkiaSharp, it is possible to also add a dependency to TesserNet.System.Drawing, TesserNet.ImageSharp or TesserNet.SkiaSharp respectively. Adding either of these dependencies adds the following Read methods:

string Read(Image image);
string Read(Image image, Rectangle rectangle);
Task<string> ReadAsync(Image image);
Task<string> ReadAsync(Image image, Rectangle rectangle);

Furthermore, when trying to use concurrency, it might be useful to have a look at the TesseractPool class:

TesseractPool pool = new TesseractPool();

The TesseractPool class provides a pooling mechanism for running the OCR on multiple Tesseract instances, without having to manually deal with all the different instances. The class has the following methods:

string Read(byte[] data, int width, int height, int bytesPerPixel);
string Read(byte[] data, int width, int height, int bytesPerPixel, int rectX, int rectY, int rectWidth, int rectHeight);
Task<string> ReadAsync(byte[] data, int width, int height, int bytesPerPixel);
Task<string> ReadAsync(byte[] data, int width, int height, int bytesPerPixel, int rectX, int rectY, int rectWidth, int rectHeight);

And when either of the aforementioned image processing bridging libraries are present:

string Read(Image image);
string Read(Image image, Rectangle rectangle);
Task<string> ReadAsync(Image image);
Task<string> ReadAsync(Image image, Rectangle rectangle);
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
0.7.0 76 4/13/2022
0.6.0 183 11/9/2021
0.5.1 841 10/6/2021
0.5.0 152 10/6/2021
0.4.0 128 10/4/2021
0.3.0 237 10/21/2020
0.2.0 198 10/18/2020
0.1.0 230 10/17/2020