Table of Contents

Method Read

Namespace
LMKit.Extraction.Barcodes
Assembly
LM-Kit.NET.dll

Read(ImageBuffer, CancellationToken)

Reads every barcode of a decoded image, in the order the reader found them. An image without a barcode returns an empty list.

public IReadOnlyList<BarcodeDetection> Read(ImageBuffer image, CancellationToken cancellationToken = default)

Parameters

image ImageBuffer

The image (GRAY8, RGB24, RGBA32 or BINARY1).

cancellationToken CancellationToken

Cancels the read before it starts.

Returns

IReadOnlyList<BarcodeDetection>

The barcodes found, positioned in the image's pixels.

Exceptions

ArgumentNullException

image is null.

NotSupportedException

The image's pixel format is not supported.

ArgumentException

A format in Formats is unknown to the native reader.

RuntimeException

The native reader failed.

Read(string, CancellationToken)

Reads every barcode of an image file (its first page for a multi-page TIFF).

public IReadOnlyList<BarcodeDetection> Read(string imagePath, CancellationToken cancellationToken = default)

Parameters

imagePath string

The image file (PNG, JPEG, TIFF, BMP, WebP...). For a PDF, use ReadPages(string, string, int, string, CancellationToken).

cancellationToken CancellationToken

Cancels the read before it starts.

Returns

IReadOnlyList<BarcodeDetection>

Exceptions

ArgumentNullException

imagePath is null or empty.

Read(Attachment, int, int, CancellationToken)

Reads every barcode of one page of a document (PDF, image, multi-page TIFF...).

public IReadOnlyList<BarcodeDetection> Read(Attachment source, int pageIndex, int dpi = 200, CancellationToken cancellationToken = default)

Parameters

source Attachment

The document.

pageIndex int

The zero-based page index.

dpi int

The resolution a PDF or other vector page is rendered at; image pages are read at their own resolution.

cancellationToken CancellationToken

Cancels the read.

Returns

IReadOnlyList<BarcodeDetection>

The barcodes found, with their PageIndex and PageRegion, in reading order.

Exceptions

ArgumentNullException

source is null.

ArgumentOutOfRangeException

pageIndex or dpi is out of range.

Exception

The page could not be rendered or decoded (the original error).

Share