Table of Contents

Constructor ImageRedactionArea

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

ImageRedactionArea(int, IBounds)

Initializes a redaction area from a page index and a bounding box: the whole rectangle is covered with an opaque fill (Rectangle, Fill).

public ImageRedactionArea(int pageIndex, IBounds bounds)

Parameters

pageIndex int

Zero-based page index.

bounds IBounds

The region to redact, in top-left origin image pixels. Any IBounds is accepted, including a Rectangle, a layout TextElement, or a search match's bounds. The edges are normalized, so reversed edges are handled.

Exceptions

ArgumentOutOfRangeException

Thrown when pageIndex is negative.

ArgumentNullException

Thrown when bounds is null.

ArgumentException

Thrown when bounds has a non-positive width or height.

ImageRedactionArea(int, IBounds, ImageRedactionShape, ImageRedactionCover)

Initializes a redaction area from a page index, a bounding box, the shape covered inside it and what it is covered with.

public ImageRedactionArea(int pageIndex, IBounds bounds, ImageRedactionShape shape, ImageRedactionCover cover)

Parameters

pageIndex int

Zero-based page index.

bounds IBounds

The bounds of the region to redact, in top-left origin image pixels. Any IBounds is accepted. The edges are normalized, so reversed edges are handled.

shape ImageRedactionShape

Which pixels of bounds are covered: the whole rectangle, or the ellipse inscribed in it.

cover ImageRedactionCover

What the covered pixels are painted with: the options' fill color, or a pixelation or blur computed from a coarse grid so the content cannot be recovered.

Examples

using LMKit.Media.Image;
using LMKit.Graphics.Geometry;

var request = new ImageRedactionRequest();
request.Areas.Add(new ImageRedactionArea(
    0, Rectangle.FromSize(120, 40, 80, 100), ImageRedactionShape.Ellipse, ImageRedactionCover.Pixelate));
ImageRedactionResult result = ImageRedactor.RedactToBytes(File.ReadAllBytes("photo.jpg"), request);

Exceptions

ArgumentOutOfRangeException

Thrown when pageIndex is negative, or when shape or cover is not a defined value.

ArgumentNullException

Thrown when bounds is null.

ArgumentException

Thrown when bounds has a non-positive width or height.

Share