Lyo.Images.Ocr 2.0.0

dotnet add package Lyo.Images.Ocr --version 2.0.0
                    
NuGet\Install-Package Lyo.Images.Ocr -Version 2.0.0
                    
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.
<PackageReference Include="Lyo.Images.Ocr" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lyo.Images.Ocr" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Lyo.Images.Ocr" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Lyo.Images.Ocr --version 2.0.0
                    
#r "nuget: Lyo.Images.Ocr, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Lyo.Images.Ocr@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Lyo.Images.Ocr&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Lyo.Images.Ocr&version=2.0.0
                    
Install as a Cake Tool

Lyo.Images.Ocr

Lyo OCR contracts: IOcrEngine, request/response models, Y-up pixel boxes (same as BoundingBox2D), coordinate helpers, and shared OcrEngineOptions.

Concrete engines (e.g. Lyo.Images.Ocr.Tesseract) register IOcrEngine. This package only registers cross-provider options through AddOcrEngineOptions / AddOcrEngineOptionsFromConfiguration.

Examples

appsettings sample

{
  "OcrEngine": {
    "EnableMetrics": false,
    "DefaultLanguages": "eng",
    "DefaultPageSegmentationMode": "SparseTextOsd"
  }
}

Bind options from configuration

using Lyo.Images.Ocr;

services.AddOcrEngineOptionsFromConfiguration(builder.Configuration);
// then register a concrete IOcrEngine (e.g. AddTesseractOcrEngine).

Types

Type Description
IOcrEngine ReadAsync(Stream imageStream, OcrReadRequest?, CancellationToken) → Task<Result<OcrPageResult>>. OCR on an encoded raster stream (PNG/JPEG/etc.).
OcrReadRequest Optional overrides for one call: Languages, PageSegmentationMode, MinimumConfidencePercent.
OcrPageResult FullText, Words (pixel Y-up bounding boxes), Lines (grouped), ImageWidth, ImageHeight.
OcrWord / OcrLine Word and line records in OcrPageResult. OcrWord.BoundingBoxPixels is a BoundingBox2D (Y-up).
OcrEngineOptions EnableMetrics, DefaultLanguages (default "eng"), DefaultPageSegmentationMode (default SparseTextOsd); SectionName = "OcrEngine".
OcrPageSegmentationMode Layout modes that do not depend on a provider (AutoOsd, Auto, SingleColumn, SingleBlock, SingleLine, SingleWord, CircleWord, SingleChar, SparseTextOsd, …).
OcrCoordinateTransforms FromTopLeftDownwardRect, MapPixelBoxToPdfPoints, and other helpers that convert among raster, Y-up pixel, and PDF point coordinates.
OcrLineGrouper Turns OcrWord results into OcrLine rows.
OcrMetrics / OcrErrorCodes Shared metric names and error codes for engines.
OcrServiceCollectionExtensions Container helpers: AddOcrEngineOptions(Action<OcrEngineOptions>?), AddOcrEngineOptionsFromConfiguration(IConfiguration, sectionName?).

How boxes are oriented

  • OcrWord.BoundingBoxPixels is Y-up: origin at the image bottom-left, so Top > Bottom and Height = Top - Bottom matches BoundingBox2D.
  • OcrCoordinateTransforms.FromTopLeftDownwardRect converts typical top-left raster rects (e.g. Tesseract) into this form.
  • For a PDF overlay on a rendered page, call OcrCoordinateTransforms.MapPixelBoxToPdfPoints (see Lyo.Pdf.Ocr).

Dependencies

Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).

  • Lyo.Common.Metadata (direct, lyo)
  • Lyo.Configuration (direct, lyo)
  • Lyo.Exceptions (direct, lyo)
  • Lyo.Metrics (direct, lyo)
  • Lyo.Result (direct, lyo)
  • Microsoft.Extensions.DependencyInjection.Abstractions 10.0.5 (direct, microsoft)
  • Microsoft.Extensions.Logging.Abstractions 10.0.5 (direct, microsoft)
  • Lyo.Common.Core (transitive, lyo)
  • Microsoft.Bcl.AsyncInterfaces 10.0.5 (transitive, microsoft, netstandard2.0)
  • Microsoft.Extensions.Configuration.Binder 10.0.5 (transitive, microsoft)
  • System.Memory 4.6.3 (transitive, microsoft, netstandard2.0)
  • System.Text.Json 10.0.5 (transitive, microsoft, netstandard2.0)
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Lyo.Images.Ocr:

Package Downloads
Lyo.Images.Ocr.Tesseract

Tesseract-backed implementation of Lyo.Images.Ocr (local OCR).

Lyo.Pdf.Ocr

OCR pipeline for PDF pages: rasterize (PDFium), run IOcrEngine, map pixel boxes to PDF points.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 70 9/9/2026
1.0.13 126 8/25/2026
1.0.11 116 8/23/2026
1.0.9 120 8/22/2026
1.0.6 109 8/20/2026
1.0.4 144 8/20/2026
1.0.3 112 8/19/2026
1.0.2 129 8/19/2026
1.0.1 116 8/18/2026
1.0.0 123 8/16/2026