Nodes/comfyui-dsocr-bbox/RapidOCR Text Mask (PP-OCR)
ComfyUI Node

RapidOCR Text Mask (PP-OCR)

The quickest way to a text-region mask in ComfyUI

By maomaozi·Created 2 months ago·Updated 2 months ago· 0
RapidOCR Text Mask (PP-OCR)
  • image
  • mask
  • detections_json
speed_profilebalanced
minimum_confidence0.72
padding8
mask_shapepolygon
acceleratorauto
cpu_threads0
invert_maskfalse

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, default 0.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, default 8. This is your seam insurance for inpainting; a few extra pixels of mask beyond the glyphs make the inpaint blend better.
  • mask_shape - polygon preserves rotated OCR boxes; rectangle uses 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 - auto picks CUDA only when ONNX Runtime exposes CUDAExecutionProvider; 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.

CategoryDeepSeek OCR

Inputs (8)

NameTypeDefaultDescription
imageIMAGE
speed_profileCOMBObalanced3 options: fast, balanced, thorough
minimum_confidenceFLOAT0.720–1
paddingINT80–256
mask_shapeCOMBOpolygon2 options: polygon, rectangle
acceleratorCOMBOauto3 options: auto, cpu, cuda
cpu_threadsINT00–128
invert_maskBOOLEANfalse

Outputs (2)

NameTypeDescription
maskMASK
detections_jsonSTRING