Method RedactToBytes
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
attachmentAttachmentThe attachment carrying the source image.
requestImageRedactionRequestWhat to redact.
optionsImageRedactionOptionsOptional redaction options; defaults are used when
null.cancellationTokenCancellationTokenCancellation token.
Returns
- ImageRedactionResult
The redacted bytes and the report describing what was covered.
Exceptions
- ArgumentNullException
Thrown when
attachmentorrequestis 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
imageDatabyte[]The encoded source image.
requestImageRedactionRequestWhat to redact.
optionsImageRedactionOptionsOptional redaction options; defaults are used when
null.cancellationTokenCancellationTokenCancellation token.
Returns
- ImageRedactionResult
The redacted bytes and the report describing what was covered.
Exceptions
- ArgumentNullException
Thrown when
imageDataorrequestis 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
inputPathstringFile-system path to the source image.
requestImageRedactionRequestWhat to redact.
optionsImageRedactionOptionsOptional redaction options; defaults are used when
null.cancellationTokenCancellationTokenCancellation token.
Returns
- ImageRedactionResult
The redacted bytes and the report describing what was covered.
Exceptions
- ArgumentException
Thrown when
inputPathis null or whitespace.- ArgumentNullException
Thrown when
requestis null.- FileNotFoundException
Thrown when
inputPathdoes not exist.- InvalidOperationException
Thrown when the request carries search terms but no OcrEngine.
- ImageLoadingException
Thrown when the image data cannot be decoded.