← awmium/agent-kit
agent-kit/data-masker.mdread-only
---
date: 2026-10-10
tags: [power-bi, privacy, ocr, windows]
stack: [python, onnx, windows-ocr]
read: 3 min
license: MIT
deps: pillow, numpy, rapidocr, pywebview, winrt
---

data-masker

A report screenshot says more than you meant it to. The layout is what you want to show, but every card, axis and table cell carries a real figure. data-masker finds every number in the image and masks it, so the design can be shared and the data cannot.

Drop screenshots or a whole folder in, pick a mode, mask, then check the result on a before and after slider. There is a desktop window for everyday use and a command line for batches.

A 26 second tour: drop a report in, pick a mode, mask it, then drag the compare slider. The report is fictional, drawn for the demo.
tip Nothing leaves your machine

data-masker makes no network calls. Both text readers run on your PC: the OCR models ship inside the install, and the window is a local page with its own fonts. Your images are never uploaded anywhere. The only time it touches the internet is the one-off pip install of its libraries.

How it works

Two OCR engines read each image, because neither catches everything alone.

  • RapidOCR (PaddleOCR models on ONNX, bundled in the package) reads digits reliably, but returns whole lines that are then split into numbers.
  • Windows OCR (built into Windows) gives exact word boxes, but skips some table cells and only reads a band of text sizes, so it runs at several scales.
  • A second look: after masking, Windows OCR reads the result again, up to two rounds, and masks anything it can still see.

A full-screen report takes about 5 to 10 seconds once the engine is warm. It runs below normal priority on at most four cores, so the rest of the PC stays responsive.

Modes

ModeExampleUse when
Fake1,284 becomes 7,051Realistic-looking demo shots. The same number gets the same fake within a run.
Hash$1,284.50 becomes $#,###.##The format should stay visible, the digits should not.
Full$1,284.50 becomes #########Nothing about the value may leak.
Ratioevery number times one factorCharts and totals must still make sense relative to each other.

Dates, years, times and labels like Q1 or FY26 are kept by default; untick that to mask them too. In ratio mode, percentages are kept, because scaling every value by the same factor leaves shares and growth rates unchanged.

Install

You need Windows 10 or 11 and Python 3.10 or newer.

powershell
git clone https://github.com/awmium/data-masker
pip install winrt-runtime winrt-Windows.Media.Ocr winrt-Windows.Globalization winrt-Windows.Graphics.Imaging winrt-Windows.Storage.Streams winrt-Windows.Foundation winrt-Windows.Foundation.Collections pillow numpy rapidocr_onnxruntime pywebview

Then double-click Data Masker.bat in the clone.

Use

  • Window: drop images or a folder, pick a mode, press enter to mask. Keys: j and k move through the list, 1, 2 and 3 switch between original, masked and compare, o opens the output, t switches the theme.
  • Command line, for batches:
powershell
python datamask.py <images or folders> --mode fake --out masked

Masked files are saved next to the originals in a Masked - <folder> folder, or wherever you point --out. Files already starting with Masked - are skipped when a folder is added again.

Limits

  • Look before you share. OCR can miss tiny or stylised text. The thorough scan adds more scales, an inverted pass for dark themes and overlapping tiles; use it when a number slips through.
  • Windows only. One of the two engines is Windows' own OCR.
  • Numbers only. Names, labels and other text stay as they are.
read# data-masker[ ] sections603 words · 3 minTop