Lyo.Images.Ocr 1.0.2

dotnet add package Lyo.Images.Ocr --version 1.0.2
                    
NuGet\Install-Package Lyo.Images.Ocr -Version 1.0.2
                    
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="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lyo.Images.Ocr" Version="1.0.2" />
                    
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 1.0.2
                    
#r "nuget: Lyo.Images.Ocr, 1.0.2"
                    
#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@1.0.2
                    
#: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=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Lyo.Images.Ocr&version=1.0.2
                    
Install as a Cake Tool

Lyo.Images.Ocr

Engine-agnostic OCR contracts for Lyo: IOcrEngine, request/response models, Y-up pixel bounding boxes (aligned with BoundingBox2D), coordinate helpers, and shared OcrEngineOptions.

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

Examples

Configuration

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

Configuration (2)

using Lyo.Images.Ocr;

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

Public API

Type Description
IOcrEngine ReadAsync(Stream imageStream, OcrReadRequest?, CancellationToken) → Task<Result<OcrPageResult>> — runs OCR on an encoded raster stream (PNG/JPEG/etc.).
OcrReadRequest Optional per-call overrides: Languages, PageSegmentationMode, MinimumConfidencePercent.
OcrPageResult FullText, Words (with pixel Y-up bounding boxes), Lines (grouped), ImageWidth, ImageHeight.
OcrWord / OcrLine Word + line records used in OcrPageResult. OcrWord.BoundingBoxPixels is a BoundingBox2D (Y-up).
OcrEngineOptions EnableMetrics, DefaultLanguages (default "eng"), DefaultPageSegmentationMode (default SparseTextOsd); SectionName = "OcrEngine".
OcrPageSegmentationMode Provider-neutral layout modes (AutoOsd, Auto, SingleColumn, SingleBlock, SingleLine, SingleWord, CircleWord, SingleChar, SparseTextOsd, …).
OcrCoordinateTransforms FromTopLeftDownwardRect, MapPixelBoxToPdfPoints, and other helpers to convert between raster, Y-up pixel, and PDF point coordinates.
OcrLineGrouper Groups OcrWord results into OcrLine rows.
OcrMetrics / OcrErrorCodes Metric name and error code constants for engines to use consistently.
OcrServiceCollectionExtensions DI: AddOcrEngineOptions(Action<OcrEngineOptions>?), AddOcrEngineOptionsFromConfiguration(IConfiguration, sectionName?).

Bounding boxes

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

Dependencies

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

  • Lyo.Common — (direct, lyo)
  • Lyo.Exceptions — (direct, lyo)
  • Lyo.Metrics — (direct, lyo)
  • Lyo.Result — (direct, lyo)
  • Microsoft.Extensions.Configuration.Binder 10.0.5 — (direct, microsoft)
  • Microsoft.Extensions.DependencyInjection.Abstractions 10.0.5 — (direct, microsoft)
  • Microsoft.Extensions.Logging.Abstractions 10.0.5 — (direct, microsoft)
  • Microsoft.Extensions.Options.ConfigurationExtensions 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.Pdf.Ocr

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

Lyo.Images.Ocr.Tesseract

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

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 0 8/19/2026
1.0.1 27 8/18/2026
1.0.0 66 8/16/2026