Table of Contents

Method RedactToBytes

Namespace
LMKit.Media.Image
Assembly
LM-Kit.NET.dll

RedactToBytes(Attachment, ImageRedactionRequest, ImageRedactionOptions, CancellationToken)

Redacts the image carried by attachment and returns the redacted bytes together with the report.

public static ImageRedactionResult RedactToBytes(Attachment attachment, ImageRedactionRequest request, ImageRedactionOptions options = null, CancellationToken cancellationToken = default)

Parameters

attachment Attachment

The attachment carrying the source image.

request ImageRedactionRequest

What to redact.

options ImageRedactionOptions

Optional redaction options; defaults are used when null.

cancellationToken CancellationToken

Cancellation token.

Returns

ImageRedactionResult

The redacted bytes and the report describing what was covered.

Exceptions

ArgumentNullException

Thrown when attachment or request is null.

NotSupportedException

Thrown when the attachment does not carry a raster image.

InvalidOperationException

Thrown when the request carries search terms but no OcrEngine.

ImageLoadingException

Thrown when the image data cannot be decoded.

RedactToBytes(byte[], ImageRedactionRequest, ImageRedactionOptions, CancellationToken)

Redacts in-memory image bytes and returns the redacted bytes together with the report.

public static ImageRedactionResult RedactToBytes(byte[] imageData, ImageRedactionRequest request, ImageRedactionOptions options = null, CancellationToken cancellationToken = default)

Parameters

imageData byte[]

The encoded source image.

request ImageRedactionRequest

What to redact.

options ImageRedactionOptions

Optional redaction options; defaults are used when null.

cancellationToken CancellationToken

Cancellation token.

Returns

ImageRedactionResult

The redacted bytes and the report describing what was covered.

Exceptions

ArgumentNullException

Thrown when imageData or request is null.

InvalidOperationException

Thrown when the request carries search terms but no OcrEngine.

ImageLoadingException

Thrown when the image data cannot be decoded.

RedactToBytes(string, ImageRedactionRequest, ImageRedactionOptions, CancellationToken)

Redacts the image at inputPath and returns the redacted bytes together with the report.

public static ImageRedactionResult RedactToBytes(string inputPath, ImageRedactionRequest request, ImageRedactionOptions options = null, CancellationToken cancellationToken = default)

Parameters

inputPath string

File-system path to the source image.

request ImageRedactionRequest

What to redact.

options ImageRedactionOptions

Optional redaction options; defaults are used when null.

cancellationToken CancellationToken

Cancellation token.

Returns

ImageRedactionResult

The redacted bytes and the report describing what was covered.

Exceptions

ArgumentException

Thrown when inputPath is null or whitespace.

ArgumentNullException

Thrown when request is null.

FileNotFoundException

Thrown when inputPath does not exist.

InvalidOperationException

Thrown when the request carries search terms but no OcrEngine.

ImageLoadingException

Thrown when the image data cannot be decoded.

Share