ZML_画画
Scribble on an image, get an image and a mask
- 图像
- 画笔图像
- 图像
- 绘制图层
- 遮罩
ComfyUI has no shortage of ways to tell an inpainting pipeline where to paint. ZML_ImagePainter (ZML_画画, "drawing") is the bluntest and, honestly, one of the most useful: it gives you a canvas, you scribble on it, and it hands you back the scribbled image, the scribble layer alone, and a mask of exactly what you drew. Three outputs from one doodle - that's the whole value proposition.
It's from ComfyUI-ZML-Image, zml-w's 160+ node pack, and it's been in there since the early days - it even has a dedicated entry in the pack's release notes with a series of "fixed the painting node" lines, which tells you it's a node the author actually uses.
How it works
Open the node's UI and you get a canvas. Paint with a brush, drop in shapes, or stamp images - the front-end lets you draw freehand paths, paint with a custom brush image, add mosaic (pixelate) rectangles, and fill shapes. Everything you draw is serialized into the hidden paint_data JSON and replayed on execution in the backend: paths get stroked, stamps get pasted, mosaic regions get pixelated.
The three outputs are the real feature:
- 图像 - your input image (or a blank canvas) with everything painted onto it, composited.
- 绘制图层 (draw layer) - just the paint, on a transparent layer, separate from the image. Composite this yourself wherever you like.
- 遮罩 (mask) - a black-and-white mask of the painted regions, ready to feed any inpainting node.
The inputs that matter
- 图像 (optional IMAGE) - the image to paint over. Leave it empty and the node creates a blank black canvas sized by 默认宽 / 默认高 (default 1024×1024).
- 画笔图像 (optional IMAGE) - your stamp brush. Connect an image and you can stamp it onto the canvas, which is a fast way to add texture or elements.
- 清空绘制内容 - when on, the canvas clears every time you open the UI. When off, it keeps your last drawing so you can iterate.
- 启用自适应动画 - cosmetic; a window-resize animation when the editor opens. Turn it off if it annoys you.
Installing it
Pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/zml-w/ComfyUI-ZML-Image
restart ComfyUI or use ComfyUI Manager (search "ComfyUI-ZML-Image"). No models to download; this node is pure Python + front-end canvas.
Where people get caught
The drawing lives in the node's paint_data, which is stored in the workflow - that's usually what you want (it travels with the graph), but it also means a shared workflow ships your scribbles. If you're handing a workflow to someone, clear the canvas or note the drawing.
And because the front-end does the drawing while the backend just replays it, the two must agree on coordinates - this is the class of bug the author's "fixed the painting node" changelog lines are about. If you update the pack and a saved workflow's paint stops lining up with the image, that's the source. Keep the pack updated.
When you'd actually reach for it
The killer combo: paint roughly over a face or a hand, take the 遮罩 output, feed it to an inpaint node, and regenerate just that region. It's the fastest way from "there's a flaw in this image" to "a masked inpaint pass" without pulling up a dedicated masking tool. For a one-node mask-maker plus a bonus paint layer, it's hard to beat.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| 默认宽 | INT | 10241–8192 | — |
| 默认高 | INT | 10241–8192 | — |
| 清空绘制内容 | BOOLEAN | false | 开启此按钮时,每次打开绘制UI都会清空画布 |
| 启用自适应动画 | BOOLEAN | true | 开启此按钮时,打开UI会显示窗口自适应动画;关闭时直接显示默认大小窗口 |
| paint_data | STRING | {} | — |
| 图像opt | IMAGE | — | |
| 画笔图像opt | IMAGE | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| 图像 | IMAGE | — |
| 绘制图层 | IMAGE | — |
| 遮罩 | MASK | — |