From 2 Seconds to 5 ms:
Inside Framecho Auto Redact v2
Making one-click Auto Redact truly fast and dependable doesn’t mean adding a wall of sliders—it means keeping every geometric, visual, and semantic decision inside the local engine. Here is the complete story from v1 bottlenecks and zero-extra-settings discipline to real Apple M4 benchmarks and live-tested polish.
How Auto Redact v2 was shaped step by step
Reliable Mac tools rarely come from piling on options—they come from measuring bottlenecks, keeping the engine smart, and refining real-world edge cases.
On a 5K Retina display (5120×2880, 5.4 MB PNG), clicking Auto Redact in v1 took over two seconds (
2011.8 ms) while still missing targets or clipping normal UI copy:- The hidden PNG decode wall: reading from disk forced a ~1.14 s
CGImageSourcePNG decode on 5K before running two serial OCR passes across 12 tiles. - Rough geometry: proportional-font substring offsets estimated by character ratio drifted up to
38.03 pxoniiiiiii me@company.io, repeated per-box pixel sampling wasted CPU, and single-line header avatars, table columns, and QR codes were missed. - Context blind spots: code attributes like
@MainActor,@Observable,@media, browser versions, and timestamps tripped redaction, leavingide-terminalprecision at33.3%.
- The hidden PNG decode wall: reading from disk forced a ~1.14 s
Every detection upgrade works automatically by default with zero learning curve, keeping the toolbar clean and familiar:
- Zero new Settings: kept the exact 3 wand toggles (Sensitive Text / Usernames / Avatars), 2 styles (Pixelate / Blur), and the existing
Strengthslider. - Silent capability folding: QR code detection folds naturally under Sensitive Text; avatar mask shape adapts automatically from pixel geometry instead of asking the user.
- Lightweight review pill: after redacting, one subtle bottom pill summarizes the 3 categories—hover highlights matching boxes, click toggles a category, Undo reverts all, and 8 s of idle fades it out.
- Zero new Settings: kept the exact 3 wand toggles (Sensitive Text / Usernames / Avatars), 2 styles (Pixelate / Blur), and the existing
Rebuilt the entire detection and layout pipeline around sub-second latency and zero false positives:
- Fast path: direct in-memory
CGImagehandoff skips PNG disk round-trips; 200 ms idle selection triggers.utilitybackground prewarming; ROI-intersecting tiles scan first while grayscale variance prunes blank wallpaper; selective second-passcjkFirstOCR runs only where needed alongside batched Vision faces/bodies/QR and a single 1× raster pass. - Exact alignment: replaced length heuristics with Vision’s UTF-16 word-level
spansbounding rects. - Contextual precision: multi-secret line splitting, 18-digit Chinese ID ISO 7064 Mod 11-2 checksums, credentialed URIs (
postgres://), table header propagation, vertical key-value forms, Shannon entropy ≥ 3.5 gating, plus code/version/timestamp exclusions.
- Fast path: direct in-memory
No guesswork: compiled production Swift 6 code (
-O) on Apple M4 / macOS 27.2.1 to pit v1 (git HEAD) directly against v2 across 6 Retina fixtures. Prewarmed 1080p selection hits5.04 ms(399×), cold selection runs400.6 ms(5.02×), recall climbs from60.0%to92.5%, and false positives drop to zero.While testing daily builds of
Framecho Devon real WeChat conversations and code editors, two tactile flaws surfaced that automated precision tables never reveal—both were fixed the same day:1. Rounded-square avatars without exposed cornersWeChat and similar messengers use squircle/rounded-square avatars; an elliptical mask left all four corners peeking out. The 1× raster pass now measures
cornerClearance: true circles (≥ 0.78) keep.ellipse, while rounded squares automatically switch to.roundedRect.2. First-click single box selection after redactingStaying on a drawing tool after Auto Redact meant clicking an unwanted redaction box accidentally started drawing a new shape. Framecho now resets immediately to
.selectwith an empty selection—one click selects a box,⌫removes it, and⌘Zstill undoes the whole batch.
5K Screen 2011.8 ms → 5.04 ms: Breaking the PNG Decode Wall
Measured on Apple M4 · macOS 27.2.1 with -O optimization, 3-run median per entry and fresh cache keys on cold runs.
CGImageSource. Moving area capture and the editor to in-memory CGImage handoff + ROI-first tiling + 200 ms speculative prewarm turned a 2-second stall into an imperceptible click.Mid-Size Screenshots (v1 Disk URL vs v2 In-Memory Cold)
admin-table
ide-terminal
qr-and-form
clean-toolbar
6 Retina Scenes Side by Side: Higher Recall, Zero False Positives
Select a fixture chip below to inspect its sensitive targets, decoys, and v1 vs v2 detection counts.
All 6 Retina Scenes Summary (40 Sensitive Targets + Decoys)
Covers 5K dual-window desktop, mixed CJK group chat, multi-column admin table, IDE & terminal logs, QR + vertical form cards, and a clean toolbar control scene.
| Scene | Targets | v1 TP | v1 FN | v1 FP | v2 TP | v2 FN | v2 FP | Key Change |
|---|---|---|---|---|---|---|---|---|
5k-desktop | 9 | 6 | 3 | 0 | 8 | 1 | 0 | Recovered QR code + right-window name |
chat-mixed | 10 | 5 | 5 | 2 | 8 | 2 | 0 | Left header avatar + CJK propagation, 0 FP |
admin-table | 12 | 8 | 4 | 1 | 12 | 0 | 0 | 100% Recall / 100% Precision |
ide-terminal | 5 | 3 | 2 | 6 | 5 | 0 | 0 | Precision 33.3% → 100% (6 → 0 FP) |
qr-and-form | 4 | 2 | 2 | 0 | 4 | 0 | 0 | TOTP QR + vertical key-value fields |
clean-toolbar | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 FP in just 130.7 ms |
| Total (6 Scenes) | 40 | 24 | 16 | 9 | 37 | 3 | 0 | Recall 92.5% · Precision 100% |
What makes a tool feel sharp sits in the last few pixels
Accuracy isn’t only recall percentages—it is tight glyph bounds, sealed avatar corners, and effortless one-click cleanup.
4.2× tighter substring left-edge accuracy
In proportional fonts (such as iiiiiii me@company.io), narrow i characters skew ratio estimates—causing 38.03 px left-edge drift in v1. v2 queries Vision’s exact UTF-16 word spans rects, cutting error to 9.07 px (mostly intentional safety padding).
WeChat rounded-square avatars fit cleanly
Live testing showed circular ellipses exposed corners on WeChat’s squircle avatars. The 1× raster pass inspects cornerClearance: values ≥ 0.78 keep .ellipse, while lower clearance selects .roundedRect to seal all four corners.
No extra settings, effortless per-box cleanup
The toolbar stays untouched with its 3 toggles and 2 styles. Right after Auto Redact finishes, Framecho switches to .select with nothing selected—click any single box and press ⌫ to remove it without starting a drag selection. The subtle AutoRedactionReviewPill supports category toggles and full Undo before fading after 8 s.
Every pixel stays on your Mac. Offline by design.
Screenshots awaiting redaction hold real secrets—chats, API keys, connection strings, IDs. Every Vision request, raster pass, and heuristic in Framecho v2 runs 100% on-device via Apple Vision and CoreGraphics.
100% On-Device Vision
OCR, faces, QR codes, table inference, and secret entropy checks never touch a server.
Complex inside, simple outside
Multi-secret splitting, code exemptions, and rounded-square detection require zero regex sliders from users.
Backward Compatible
Existing .framecho documents open untouched on macOS 15+; optional RedactionShape defaults safely.
Open about the remaining 3 missed targets
Publishing what didn’t hit 100% sets clear engineering targets for the next pass.
2 Remaining Miss Patterns (3 / 40 Missed)
- Unspaced inline CJK + phone (
5k-desktopw1-phone): Strings like"联系电话 138-0013-8888 已更新"occasionally tokenize awkwardly at 5K scale (whereas the same number matches reliably inchat-mixedandqr-and-form). Next step: tighten CJK/digit boundary splitting. - Asymmetric two-line right chat bubble (
chat-mixedright-avatar/right-name): When an outgoing right-hand bubble has only two lines whose horizontal offset exceedsinfoBlockstolerance, the right-hand slot is skipped. Planned fix: add dedicated single-line right-aligned bubble slots.
Reproducible Environment
- Hardware & Timestamp: Apple M4 · macOS 27.2.1 · Swift 6 strict concurrency (
-strict-concurrency=complete -default-isolation MainActor) ·-O; benchmarks recorded2026-11-28 19:19 (UTC+9). - Fixtures: 6 synthetic 144 dpi (2× Retina) scenes totaling 40 sensitive targets plus high-frequency false-positive decoys.
- Timing: 1 process-level warmup, then 3-run median (ms) per entry with unique invalidated
cacheKeyper cold run. - Verification:
check-smart-redaction,check-annotation-engine(359 checks),check-annotation-document(50 checks),check-localizations(42,958 checks), andcheck-text-fitall pass.
Download Framecho and test both engines directly
Screenshot capture, markup, local Auto Redaction, and dual-engine Screenshot Translation are built into Framecho—zero image pixels leave your Mac.