DEV Community

Cover image for How I Built AI-Powered Auto-Redaction Into a Desktop Screenshot Tool
Khaled BH
Khaled BH

Posted on

How I Built AI-Powered Auto-Redaction Into a Desktop Screenshot Tool

Screenshots are everywhere — docs, bug reports, Slack, tweets. And half the time they've got an email,
IP address, or API key sitting right there in the open.

I built https://snpit.app, a screenshot beautifier for Windows and macOS. It started as a tool to make
screenshots look nice (gradient backgrounds, annotations, export). But the feature people keep asking
about is the auto-redact.

How it works

  1. Capture any region on screen
  2. Click the AI Redact button
  3. OCR scans the image and regex patterns match sensitive data
  4. Black bars cover every match

Built-in patterns handle emails, phone numbers, IPs, and serial keys.

The problem with dark backgrounds

Tesseract (the OCR engine) is great at reading dark text on light backgrounds. But white text on a dark
background? It just misses it.

So I added multi-pass scanning. Every image gets processed 3 times:

  • Original — catches normal text
  • Inverted — flips all pixels so white-on-dark becomes black-on-light
  • High-contrast threshold — converts to pure black and white at 128

Results get merged and deduplicated. This is what made credit card screenshots actually work.

Custom regex + AI generation

The built-in patterns cover common stuff. But what about internal ticket IDs, custom API key formats, or
proprietary codes?

Instead of asking users to write regex (nobody wants to), I added an AI button. You describe what to
find in plain English:

▎ "AWS access keys"

The AI generates the regex pattern. You can review it, test it, save it for reuse, or just run it once.

AI Vision

There's also a built-in AI chat that reads your screenshot. You can ask:

  • "What error is shown?"
  • "Summarize the text in this screenshot"
  • "Generate alt text for this image"

Runs on a self-hosted model, streams responses, keeps conversation context.

The stack

  • Desktop app: Electron + React + Fabric.js
  • OCR: Tesseract.js v7 (runs locally, no cloud)
  • AI: Private model -- Nothing will be logged.
  • Backend: Laravel 12 + Stripe + Cloudflare R2
  • Website: https://snpit.app

Everything runs locally. Screenshots never leave your machine unless you explicitly publish to cloud.

Try it

Free to download, free to use the core features: https://snpit.app/download

If you work with screenshots that contain sensitive data, I'd genuinely love feedback on the redaction
accuracy. Especially edge cases — weird fonts, low contrast, unusual formats.

Top comments (0)