Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > ComfyUI-DonutNodes > Donut Inpaint · Keep Surroundings

ComfyUI Node: Donut Inpaint · Keep Surroundings

Class Name

DonutInpaintComposite

Category
donut/editing
Author
donutsdelivery (Account age: 0days)
Extension
ComfyUI-DonutNodes
Latest Updated
2026-11-12
Github Stars
0.03K

How to Install ComfyUI-DonutNodes

Install this extension via the ComfyUI Manager by searching for ComfyUI-DonutNodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-DonutNodes in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Donut Inpaint · Keep Surroundings Description

Composites edits within a mask, preserving the original elsewhere and blending selection edges.

Donut Inpaint · Keep Surroundings:

DonutInpaintComposite combines an edited image with the original image so changes remain inside a selected area while the rest stays as it was. This is useful after steps such as upscaling or Face Detailer, which may otherwise alter parts of the picture you intended to preserve. The transition follows a mask: fully selected areas show the edited result, unselected areas show the original, and partially selected edges blend the two. When selected-area editing is off, the node passes the edited image through unchanged.

Donut Inpaint · Keep Surroundings Input Parameters:

image

The required IMAGE to use as the edited result. Its dimensions determine the size of the final image. Where the selection mask is fully active, this image appears in the result; where the mask is inactive, the original image stored in the inpaint data appears instead. No minimum, maximum, default value, or selectable options are specified for this input.

inpaint

An optional DONUT_INPAINT connection that supplies the original image and selection mask used for compositing. The mask controls which parts of image remain visible: a value of 1 keeps the edited image, a value of 0 restores the original, and values between them blend both images. If the supplied original image or mask has different dimensions from image, the node resizes it to match before combining them. When this input is unconnected, its default is None and image passes through unchanged. No numeric minimum, maximum, or selectable options are specified for this input.

Donut Inpaint · Keep Surroundings Output Parameters:

image

The single IMAGE output. With inpaint connected, it contains the composite: the edited result inside the selection, the original image outside it, and a blend along partially selected edges. Its dimensions match the input image. Without inpaint, it is the input image passed through unchanged. Connect this output to your next editing, preview, or saving step.

Donut Inpaint · Keep Surroundings Usage Tips:

  • Place the node after an edit, upscale, or Face Detailer step when you want changes from that step to appear only within the Edit Studio selection.
  • Connect the processed result to image and the corresponding selection data to inpaint. Using selection data from the same source image helps keep restored areas aligned with the edit.
  • Leave inpaint unconnected when selected-area editing is off; the node will pass image through without compositing.
  • Inspect the selection edge in a preview. Partially selected mask areas blend the original and edited images, so a soft edge creates a gradual transition.
  • Check the result carefully when the original image and processed image have different dimensions. The node resizes the original and mask automatically, but that cannot correct a selection that points to the wrong part of the image.

Donut Inpaint · Keep Surroundings Common Errors and Solutions:

KeyError: 'image'

  • Explanation: The connected inpaint data does not contain the original image that the node expects. This is a possible error for malformed data, not a message defined by the node itself.
  • Solution: Connect a compatible DONUT_INPAINT output that includes the original image, or leave inpaint unconnected if you do not need selected-area compositing.

KeyError: 'mask'

  • Explanation: The connected inpaint data does not contain the selection mask needed to decide where to show the edit. This is a possible error for malformed data, not a message defined by the node itself.
  • Solution: Reconnect or regenerate the selection data with a compatible node that supplies a mask.

TypeError: '...' object is not subscriptable

  • Explanation: The value connected to inpaint may not be the expected data structure containing image and mask. The exact message depends on the value supplied.
  • Solution: Check that the connection comes from a compatible DONUT_INPAINT output rather than an ordinary image or mask output.

AttributeError: '...' object has no attribute 'to'

  • Explanation: An image or mask inside the inpaint data is not a tensor in the form this node expects. The exact message depends on the unexpected value.
  • Solution: Use a compatible node to produce the inpaint data; avoid manually substituting image files, lists, or other values for its internal image and mask.

RuntimeError: The size of tensor ... must match the size of tensor ...

  • Explanation: The image, original image, or mask may have incompatible shapes that automatic resizing cannot resolve, such as mismatched batches. The exact wording depends on the mismatch.
  • Solution: Use matching image and selection data from the same workflow, and check that upstream nodes produce compatible image batches.

Donut Inpaint · Keep Surroundings Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-DonutNodes
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

Donut Inpaint · Keep Surroundings