Krita Selection
Read the active Krita selection as a mask and offset
- mask
- active
- offset x
- offset y
The inpainting glue between Krita and ComfyUI. When you lasso or paint a selection in Krita and hit generate, ETN_KritaSelection is the node that turns that selection into a mask ComfyUI can use - plus the bookkeeping (is there even a selection? where is it?) needed to put the result back in the right place. It's another integration node in Acly's tooling-nodes pack, driven by the Krita AI Diffusion plugin rather than wired by hand.
Painting a mask instead of typing coordinates is the whole appeal of the Krita route. The KB's framing of these paint-surface tools is that they move regional and inpaint control "from numeric regions to a paint surface" - you select the area you want changed with real brush tools, and the plugin handles the rest. This node is where that painted selection crosses into the workflow.
How it works
It reads the current Krita selection and outputs it as a mask, along with a flag for whether a selection is active and the selection's pixel offset on the canvas. The context setting controls how much surrounding image the operation considers - for example limiting work to the selection versus taking in the entire image as context - and padding expands the region around the selection so the model has some breathing room to blend the edit into its surroundings (a hard-edged selection with zero context tends to produce a seam).
The offset outputs matter more than they look. Because an inpaint operates on a cropped region, the result has to return to the exact spot it came from - so the offset this node reports on the way in is the same offset you feed ETN_KritaOutput on the way out. That round-trip alignment is what keeps the edit registered with the rest of the painting.
The inputs and outputs that matter
context(COMBO, defaultentire image) - how much of the image the operation uses as context around the selection. The default takes the whole image into account.padding(INT, default0, min0) - pixels of margin added around the selection, so edits blend rather than butt up against a hard boundary. A little padding usually helps inpaint seams.
Outputs:
mask(MASK) - the selection as a mask, into Set Latent Noise Mask or an inpaint node.active(BOOLEAN) - whether a selection actually exists. Useful for branching a workflow between "inpaint the selection" and "generate the whole canvas."offset x/offset y(INT) - the selection's position. Carry these to ETN_KritaOutput'sx/yso the result lands back in place.
How to install it
Ships in the tooling-nodes pack. ComfyUI Manager: search ComfyUI Nodes for External Tooling, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/Acly/comfyui-tooling-nodes.git
then restart. As with the other Krita nodes, real use means installing the Krita AI Diffusion plugin on the Krita side.
Common issues & troubleshooting
The mask is empty / active is false. There's no selection in Krita. Make one before generating, or use the active output to route to a full-canvas path when nothing is selected.
Inpaint result has a visible seam. Bump padding so the model gets margin around the selection to blend into, and reconsider context - too little surrounding context makes the edit ignore what's around it.
The edit comes back shifted. The offset x/offset y here must reach ETN_KritaOutput unchanged. If you dropped or overrode them, the result reassembles at the wrong coordinates. Keep the offsets consistent across the round trip.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| context | COMBO | entire image | Determines the section (crop bounding box) of the image and mask to transmit: - automatic: area around the selection determined by Krita settings - entire image: always use the entire canvas area - mask bounds: tight bounding box of the current selection This affects the Selection and Canvas nodes. The offset x/y outputs indicate the top-left corner of the context area relative to the full canvas. |
| padding | INT | 0 | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |
| active | BOOLEAN | — |
| offset x | INT | — |
| offset y | INT | — |