DeepSeek OCR Draw BBox
Draw DeepSeek OCR boxes and crop every region in one go
- image
- image
- crop_images
- crop_info
You've got DeepSeek OCR output and you want to see what it found - and, while you're at it, grab each detected region as its own image. That's the whole job of this node. It draws the bounding boxes (or polygon outlines) onto your image, crops each bbox region into an image batch, and writes a JSON file that remembers exactly where every crop came from. It's the inspection-and-harvest step of the pack.
Like everything in the DeepSeek half of this pack, it doesn't call any API and needs no key. The ocr_result input is a STRING socket you wire to whatever produced the OCR text - another node, an HTTP call, a pasted file. The node just parses <|ref|>...<|/ref|><|det|>...<|/det|> tags and does geometry.
The three outputs are the point
image- your source image with the boxes drawn on. Feed it to a Preview or Save node and you get instant QA: did OCR catch the watermark in the corner, or skip it?crop_images- every bbox region cut out and stacked into one IMAGE batch. This is what you'd route into a per-region upscale or a fresh inpaint pass.crop_info- JSON with pixel coordinates for every crop:box,original_box,ref,text, and source size. Don't lose this string if you plan to put the crops back later - that's what the pack's paste node reads.
That last output is what makes this a workflow component rather than a preview toy. Crop → re-render each region → paste back is the classic detailing loop (same shape as the SEGS pipeline in Impact Pack, just with OCR coordinates instead of a detector). You can even process the crops with other tools entirely, as long as you keep crop_info alongside.
Inputs you'll actually touch
Mostly three:
coord_base- default1000for DeepSeek's normalized coordinates; set0if your OCR is already in pixels.crop_expand- expands each crop outward by this many pixels (clipped to image bounds). A little padding, like 4–8, keeps the crop from cutting glyphs at the edge. Note that when you use it,boxincrop_infobecomes the expanded area whileoriginal_boxkeeps the unexpanded bbox.label-none,ref,ref + text, ortext; draws the OCR text (or its ref label) next to each box. Great for debugging, off for clean exports.
box_color, box_width, label_color, and label_font_size are cosmetic. If your text is Chinese and the labels render as tofu boxes, set font_path to a CJK font (the code knows the usual Windows/noto locations but only when you point it there).
Installing
It's part of comfyui-dsocr-bbox. Via ComfyUI Manager, search "dsocr", or:
cd ComfyUI/custom_nodes
git clone https://github.com/maomaozi/comfyui-dsocr-bbox
restart ComfyUI, and install the one dependency the pack needs for its OCR side:
pip install -r custom_nodes/comfyui-dsocr-bbox/requirements.txt
Common issues
The recurring trap is again coord_base: set 1000 on DeepSeek-normalized output and 0 on pixels, and if you're feeding this from another node that already converted to pixels, remember to flip it. Crop images come back as a batch, so ComfyUI pads them to a common size - keep that in mind if you stare at a crop and wonder why there's a black strip; the pack's paste node strips that padding automatically. Polygon detections are cropped by their enclosing rectangle while the drawn box keeps the polygon outline, which trips people up exactly once.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| ocr_result | STRING | — | |
| coord_base | INT | 10000–100000 | — |
| crop_expand | INT | 00–10000 | — |
| box_color | STRING | #ff0000 | — |
| box_width | INT | 31–100 | — |
| label | COMBO | none | 4 options: none, ref, text, ref + text |
| label_color | STRING | #ffffff | — |
| label_font_size | INT | 206–200 | — |
| font_path | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| crop_images | IMAGE | — |
| crop_info | STRING | — |