RapidOCR Text Mask (PP-OCR)
The quickest way to a text-region mask in ComfyUI
- image
- mask
- detections_json
If you want to inpaint away every scrap of text in an image, this is the node you'll reach for first. It runs RapidOCR (PP-OCR via ONNX Runtime) directly on a ComfyUI IMAGE - no API call, no DeepSeek account, no coordinate conversion step - and returns a native MASK with every detected text region filled in white. Nothing between you and the mask except one node.
It's the "just give me the text mask" sibling of RapidOCR Detect Text. Where the detector node returns JSON and leaves decisions to a pipeline, this one is opinionated and done: detect text → rasterize the regions → hand you a mask ready for VAE Encode (for Inpainting).
How it works
The engine loads lazily and runs the PP-OCR detection, classification, and recognition ONNX models. Each detected text polygon (or its enclosing rectangle, your choice) becomes a white region on a float32 [batch, height, width] mask, with padding adding outward mask pixels around each region (default 8). You also get detections_json - text, confidence, polygon, bbox, OCR variant, and which provider actually ran - which is handy for auditing why the mask looks the way it does.
Inputs that matter
minimum_confidence- recognition threshold, default0.72. This is the "what counts as real text" dial; drop it if faint watermarks aren't getting masked.padding- outward mask padding in pixels, default8. This is your seam insurance for inpainting; a few extra pixels of mask beyond the glyphs make the inpaint blend better.mask_shape-polygonpreserves rotated OCR boxes;rectangleuses enclosing boxes. For clean horizontal text they look the same; for angled text the rectangle catches more background.speed_profile-fast/balanced/thorough, same trade as the detector node: more passes catch fainter text.accelerator/cpu_threads-autopicks CUDA only when ONNX Runtime exposesCUDAExecutionProvider; otherwise CPU.invert_mask- flips selected/unselected, if you ever need "everything except text."
Installing
Part of comfyui-dsocr-bbox. ComfyUI Manager (search "dsocr") or:
cd ComfyUI/custom_nodes
git clone https://github.com/maomaozi/comfyui-dsocr-bbox
restart, then:
pip install -r custom_nodes/comfyui-dsocr-bbox/requirements.txt
First run downloads the PP-OCR ONNX models automatically. For GPU, install a CUDA-compatible onnxruntime-gpu and verify CUDAExecutionProvider is available:
python -c "import onnxruntime as ort; print(ort.get_available_providers())"
If you pick cuda without it, the node errors with a clear message.
Where people get burned
The GPU trap is the big one: auto will silently use CPU if CUDA isn't actually wired up, and on single small images CPU is often faster than GPU anyway because of transfer overhead - so don't over-index on the accelerator setting. The other classic is a mask that's all white or all black, which usually means the image is inverted or minimum_confidence is so low/high that every pixel qualifies or none do. And remember this masks text - a watermark that's pure logo with no readable glyphs won't be caught by OCR at all; that's what the GLM vision path is for.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| speed_profile | COMBO | balanced | 3 options: fast, balanced, thorough |
| minimum_confidence | FLOAT | 0.720–1 | — |
| padding | INT | 80–256 | — |
| mask_shape | COMBO | polygon | 2 options: polygon, rectangle |
| accelerator | COMBO | auto | 3 options: auto, cpu, cuda |
| cpu_threads | INT | 00–128 | — |
| invert_mask | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |
| detections_json | STRING | — |