TesserNet.ImageSharp
0.8.0
dotnet add package TesserNet.ImageSharp --version 0.8.0
NuGet\Install-Package TesserNet.ImageSharp -Version 0.8.0
<PackageReference Include="TesserNet.ImageSharp" Version="0.8.0" />
paket add TesserNet.ImageSharp --version 0.8.0
#r "nuget: TesserNet.ImageSharp, 0.8.0"
// Install TesserNet.ImageSharp as a Cake Addin #addin nuget:?package=TesserNet.ImageSharp&version=0.8.0 // Install TesserNet.ImageSharp as a Cake Tool #tool nuget:?package=TesserNet.ImageSharp&version=0.8.0
<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//u273EjX8BloAgbzcXGNh8v1h0Dl+xRRtnAh375PyVGkHmYQAXQTZDGUR3Cj4H4pCDlxglBPixAJ8GzSOl2IFAYI4zOAU2RBnglGiysUfCpo0cr2WUFgDBlEkATaUGsFJixI+kghhqTJwcM2cWLly5Zcopc85ZstWoJi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FtNnEEsJb93tYKd51fpKIc9hr51Kx7m+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 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. 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.0
- SixLabors.ImageSharp (>= 2.1.3)
- TesserNet (>= 0.8.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.