Skip to content

burnRedactions

reference
1 min readUpdated

Kind: Function

Source: atloria-monorepo/apps/screenshot-worker/src/app/screenshot/services/crop.service.ts

Burn opaque BLACK rectangles into an image, destroying the underlying pixels.

Boxes are percent (0-100) of the natural image; each is converted to a clamped pixel rect and composited as a filled black overlay. Unlike an annotation overlay (coordinates on a URL fragment), this is DESTRUCTIVE by design — a redacted region can never be recovered from the stored asset. Degenerate boxes (sub-pixel or off-canvas) are skipped. No boxes → the original buffer is returned untouched (no re-encode).

Signature

ts
async function burnRedactions(buffer: Buffer, boxes: BoxPct[], imgW: number, imgH: number): Promise<Buffer>

Parameters

NameType
bufferBuffer
boxesBoxPct[]
imgWnumber
imgHnumber

Returns: Promise<Buffer>

Was this page helpful?

Download as PDF