Table of Contents

Method RedactToFile

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

RedactToFile(string, string, ImageRedactionRequest, ImageRedactionOptions, CancellationToken)

Redacts the image at inputPath and writes the result to outputPath.

public static ImageRedactionReport RedactToFile(string inputPath, string outputPath, ImageRedactionRequest request, ImageRedactionOptions options = null, CancellationToken cancellationToken = default)

Parameters

inputPath string

File-system path to the source image.

outputPath string

Destination path for the redacted image.

request ImageRedactionRequest

What to redact.

options ImageRedactionOptions

Optional redaction options; defaults are used when null.

cancellationToken CancellationToken

Cancellation token.

Returns

ImageRedactionReport

A report describing what was covered.

Remarks

The output encoding follows the source format, not the extension of outputPath; check OutputExtension for what was written.

Exceptions

ArgumentException

Thrown when a path 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.

RedactToFile(Attachment, string, ImageRedactionRequest, ImageRedactionOptions, CancellationToken)

Redacts the image carried by attachment and writes the result to outputPath.

public static ImageRedactionReport RedactToFile(Attachment attachment, string outputPath, ImageRedactionRequest request, ImageRedactionOptions options = null, CancellationToken cancellationToken = default)

Parameters

attachment Attachment

The attachment carrying the source image.

outputPath string

Destination path for the redacted image.

request ImageRedactionRequest

What to redact.

options ImageRedactionOptions

Optional redaction options; defaults are used when null.

cancellationToken CancellationToken

Cancellation token.

Returns

ImageRedactionReport

A report describing what was covered.

Exceptions

ArgumentException

Thrown when outputPath is null or whitespace.

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.

Share