Redact Image

Redact Image is a copy-paste React component that stops redacted screenshot still readable before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/redact-image
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsRedacted screenshot still readable

Was this component page useful?

How do I install Redact Image?

pnpm dlx shadcn@latest add @bollard/redact-image

The files land in your project. They're yours to edit.

How do I use Redact Image in React?

redact-image-usage.tsx
import { findSensitiveText, RedactImage, type DetectedWord } from "@/components/ui/redact-image"

<RedactImage
  src={shot.url}
  alt="Billing screenshot with a customer's email, card number and API key"
  defaultValue={email ? [email] : []}
  detect={() => findSensitiveText(shot.words)}
/>

What input mistakes does Redact Image catch?

  • Blur or pixelation used as redaction (only solid fills are offered)
  • Box edges that leave half-covered pixels, by padding and snapping outward
  • Sensitive text your detector finds but no box covers
  • Metadata and trailing data after the image end (aCropalypse-style), by re-encoding to a fresh PNG
  • Boxes that are not solid in the exported file, by re-reading it

What props does Redact Image accept?

RedactImage props
PropTypeDefault
src* (required)

The screenshot. Must be same-origin, a data: URL or a blob: URL so it can be flattened.

string—
alt

Accessible description of the screenshot.

string—
value

Controlled redaction boxes, in image pixels.

Region[]—
defaultValue

Initial boxes when uncontrolled.

Region[][]
onValueChange

Called when boxes are drawn, accepted or removed.

(boxes: Region[]) => void—
detect

Pluggable text detector. Return regions to suggest, e.g. `findSensitiveText(ocrWords)`.

(image: HTMLImageElement) => Region[] | Promise<Region[]>—
padding

Pixels added around every box so glyph edges can't leak.

number2
fill

Box colour as RGB. Always fully opaque.

[number, number, number][0, 0, 0]
onExport

Called with the flattened, verified PNG.

(blob: Blob, report: RedactionReport) => void—
fileName

File name of the download.

string"redacted.png"
messages

Every visible string (see `REDACT_IMAGE_MESSAGES`).

Partial<RedactImageMessages>—
exportLabelstring—

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is Redact Image accessible?

  • Boxes can be moved with arrow keys and removed with Delete or Backspace
  • Each suggestion and remove button has an aria-label; hints wired with aria-describedby
  • Scan and export progress announced in polite live regions; export failures use role=alert
  • Undo and Add-box are regular buttons; icons are aria-hidden

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: If the image is uploaded, store only the exported PNG and strip metadata again server-side; never keep the original.

  • Only as good as the detector you plug in; it does not run OCR by itself
  • Cannot catch information outside the boxes you or the detector mark (faces, reflections, context)
  • The original image stays in memory until you discard it; only the export is cleaned

What expensive mistakes does Redact Image stop?

Redacted screenshot still readable

Also known as

redact · screenshot · blur · censor · image editor · privacy · bug report · black box

Field type

What dependencies does Redact Image require?

Redact Image facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameRedact Image
Registry identifier@bollard/redact-image
Install commandnpx shadcn@latest add @bollard/redact-image
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Redact Image

What form validation mistake does Redact Image catch?

Redact Image prevents redacted screenshot still readable. Helps a redacted screenshot stay redacted: solid boxes only, padded to whole pixels, flattened into a fresh PNG that is re-checked on export. Catches: Blur or pixelation used as redaction (only solid fills are offered), Box edges that leave half-covered pixels, by padding and snapping outward, Sensitive text your detector finds but no box covers, Metadata and trailing data after the image end (aCropalypse-style), by re-encoding to a fresh PNG, Boxes that are not solid in the exported file, by re-reading it. Limitation: validate redact-image schemas on backend.

How do I install redact-image with shadcn?

Run `npx shadcn@latest add @bollard/redact-image`. Sources added: registry/default/redact-image/redact-image.tsx, registry/default/redact-image/redact.ts. Package requirements: lucide-react.

What props customize Redact Image?

Redact Image accepts `src`, `alt`, `value`, `defaultValue`, `onValueChange`. Configures redact, screenshot, blur behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of redact-image?

Only as good as the detector you plug in; it does not run OCR by itself. Cannot catch information outside the boxes you or the detector mark (faces, reflections, context). The original image stays in memory until you discard it; only the export is cleaned Server requirement: If the image is uploaded, store only the exported PNG and strip metadata again server-side; never keep the original.

How does Redact Image meet accessibility guidelines?

Boxes can be moved with arrow keys and removed with Delete or Backspace. Each suggestion and remove button has an aria-label; hints wired with aria-describedby. Scan and export progress announced in polite live regions; export failures use role=alert. Undo and Add-box are regular buttons; icons are aria-hidden. Minimizes errors: blur can be reversed, redaction not secure.

Which components pair with Redact Image?