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 > ainvfx-paintaplate > Level Fill

ComfyUI Node: Level Fill

Class Name

PaintAPlate_LevelFill

Category
AInVFX/Paint a plate
Author
AInVFX (Account age: 580days)
Extension
ainvfx-paintaplate
Latest Updated
2026-11-05
Github Stars
0.03K

How to Install ainvfx-paintaplate

Install this extension via the ComfyUI Manager by searching for ainvfx-paintaplate
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ainvfx-paintaplate 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

Level Fill Description

Reduces residual brightness and color imprints in object-removal fills to blend backgrounds.

Level Fill:

PaintAPlate_LevelFill, displayed as Level Fill, helps an object-removal edit blend into the background by reducing faint brightness or color imprints left in the replacement area. A generated fill can look convincing but still contain a pale silhouette or dark smudge where the object used to be; these subtle differences can become more noticeable during later video generation or animation. The node estimates the continuing background from nearby areas that the removed object did not touch, using a coarse spatial grid and separate brightness bands so that a dark backdrop is not simply matched to a bright floor. It then applies a smooth, broad correction where the fill is relatively flat and already close to that estimate, rather than repainting fine detail. The correction is designed to avoid strong differences and textured areas, helping protect edges and newly revealed objects. It also considers whether the removed object was brighter or darker than its surroundings, favoring corrections that reduce its residual imprint. This is a targeted cleanup tool for subtle fill mismatches, not a general exposure adjustment or a replacement for generating missing background detail.

Level Fill Input Parameters:

image

Required IMAGE input containing the edited frame or image batch, including the generated replacement background. This is the image the node corrects; its width and height determine the processing resolution, and the other images and masks are resized to match. The algorithm evaluates the fill’s local brightness and variation, then adjusts its RGB values where correction is appropriate. Only positions with a positive alpha mask value receive the final adjustment, and any additional image channel is preserved by the correction function. The underlying function expects image values in the 0–1 range and uses an internal 0–255 scale for measuring level differences. No default image, selectable options, or numeric minimum and maximum are declared in the interface.

alpha

Required MASK input describing where the generated fill covers the frame, normally the edit’s soft coverage mask. The node resizes this mask to the image resolution and clips its values to 0–1 internally, with 0 representing no fill coverage and 1 representing full coverage. Intermediate values contribute proportionally to local fill measurements, helping the node estimate brightness and texture in partially covered areas. However, the final correction is applied wherever the mask is greater than 0; it is not simply multiplied by the mask value as a conventional opacity blend would be. Use the actual edit coverage mask rather than assuming it is interchangeable with the object-removal mask. A single mask can serve multiple frames, and when the mask batch is shorter than the processed image batch, its final mask is reused. No default or interface-defined numeric limits are declared; the effective internal mask range is 0–1.

base

Required IMAGE input containing the frame underneath the edit, before the object-removal fill was applied. The node uses this frame to measure untouched background regions and to assess the removed object’s brightness relative to the estimated background. This reference helps determine both the target background appearance and the appropriate direction of correction, such as darkening a pale imprint left by a bright object. Only the first three channels are used, and the reference is resized to match the edited image. Resizing does not correct framing differences, camera shifts, or misalignment, so the reference should depict the same scene in the same position. For batches, frames are paired in order, and processing stops at the shorter of the image and base batches; a single base frame is not automatically repeated across a longer image batch. No default, selectable options, or numeric minimum and maximum are declared.

paint

Required MASK input identifying where the removed object was, normally the original erase mask. Unlike alpha, which describes the fill’s coverage, paint identifies areas that should not be treated as untouched background references. After resizing and clipping this mask to 0–1, the algorithm divides the frame into grid cells and considers a cell a background reference only when its average paint coverage is at most 1%. Accurately marking the object therefore helps prevent its original appearance from contaminating the background estimate. If every cell is marked as touched, the algorithm has no untouched background to measure and returns the fill unchanged. A single mask can be reused across frames, and the last mask is reused when its batch is shorter than the processed image batch. This input is required even though the underlying mathematical function supports an omitted paint mask. No default or interface-defined numeric limits are declared; the effective internal mask range is 0–1.

enabled

Required BOOLEAN control with a default of True and the options True and False. When True, the node performs background estimation and fill correction. When False, it immediately returns image unchanged, without resizing the reference inputs or running the correction. This bypass is useful for comparing the correction with the original edit and for workflows that perform painting or lighting changes rather than object removal, since those edits may contain intentional differences that should remain. Numeric minimum and maximum values do not apply.

Level Fill Output Parameters:

image

IMAGE output containing the corrected edited frame or processed image batch. The result retains the edited image’s spatial resolution and applies smooth RGB adjustments within positive alpha coverage where the algorithm finds a suitable correction. Positions outside that coverage retain their original RGB values. The output can look identical to the input when the fill already matches, no suitable untouched background exists, or the algorithm avoids a region because of its brightness difference, texture, or correction direction. With enabled set to False, the original image is returned directly. When enabled, the output frame count follows the shorter of the image and base batches. The node also writes an informational console message reporting the average brightness movement in 0–255 levels for each processed frame; this measurement is not a separate output.

Level Fill Usage Tips:

  • Use this node after generating an object-removal fill, especially when you can still see a faint light silhouette or dark stain. It is intended to reduce subtle mismatches, not repair missing objects, obvious seams, or incorrect scene structure.
  • Connect the edit’s coverage mask to alpha and the original object-removal mask to paint. These can differ: a feathered fill may extend beyond the original object, while paint should identify the area that cannot be trusted as untouched background.
  • Keep some genuine background outside the paint mask. Masking the entire frame prevents background estimation and causes the fill to pass through unchanged.
  • Supply a base frame aligned with the edited image. Automatic resizing handles resolution differences, but it does not align displaced objects or compensate for a different camera view.
  • For image sequences, provide matching image and base batch lengths. Mask batches may be shorter because their final mask is reused, but the base batch is not extended this way.
  • Toggle enabled between True and False to judge whether the correction improves the fill. Leave it False for paint or light edits when their brightness differences are intentional.
  • Watch the console message Paint a plate Level Fill: the fill moved … levels on average to confirm that processing ran. A small or zero value can be a valid result, not a failure; it reports average brightness movement rather than every possible RGB change.
  • Do not expect additional strength, grid-size, or threshold controls in this node. These settings are internal, so your practical controls are the supplied images, mask accuracy, and enabled switch.

Level Fill Common Errors and Solutions:

Missing required input

  • Explanation: The interface requires image, alpha, base, paint, and enabled. ComfyUI may reject an incomplete graph before execution; the exact validation message depends on your installation.
  • Solution: Connect both IMAGE inputs and both MASK inputs, and make sure enabled has a Boolean value. Turning enabled off does not make the other inputs optional in the declared interface.

Output looks unchanged

  • Explanation: This is a possible processing result, not a node-specific error message. The node may be disabled, alpha may contain no positive coverage, paint may leave no untouched reference cells, or the fill may not qualify for a correction.
  • Solution: Set enabled to True, preview both masks, and confirm that paint leaves usable background outside the removed object. If the mismatch is large or highly textured, revise the generated fill rather than expecting this subtle cleanup step to repair it.

Output batch contains fewer frames than expected

  • Explanation: The node pairs image and base frames in order and stops when either batch ends. It does not automatically repeat a single base frame across a longer edited sequence.
  • Solution: Supply equal-length image and base batches. If a still reference is intentionally appropriate for every frame, repeat it into a matching batch before connecting it.

Correction matches the wrong background

  • Explanation: An inaccurate paint mask can allow parts of the original object to be treated as background, while a misaligned or unrelated base frame provides misleading reference information.
  • Solution: Check that base is the corresponding frame beneath the edit and that paint covers the removed object accurately. Correct alignment upstream and avoid expanding paint so far that all useful background references disappear.

Unexpected changes near soft mask edges

  • Explanation: Soft alpha values influence the local measurements, but the final correction is allowed at every pixel with alpha greater than 0. Even faint mask values can therefore include pixels in the correction area.
  • Solution: Preview alpha for stray low-value coverage and clean up areas that should remain untouched. If you specifically need opacity-weighted blending, blend the corrected result with the original edited image in a separate compositing step.

Tensor, array shape, or dimension error during processing

  • Explanation: The provided code does not define a custom error message for malformed data. Processing expects normal ComfyUI image batches and masks; incompatible dimensions, empty batches, or unsupported channel layouts may produce lower-level library errors.
  • Solution: Use standard IMAGE and MASK outputs, ensure that every batch contains at least one frame, and provide RGB images with at least three color channels. Masks should be two-dimensional or batches of two-dimensional masks, not unconverted color images.

Paint a plate Level Fill: the fill moved 0.0 levels on average

  • Explanation: This is an informational log message, not an error. It indicates that average brightness movement was zero or small enough to round to 0.0; it does not necessarily mean every color value was unchanged.
  • Solution: Compare the result with enabled switched off. If a visible imprint remains, verify the masks and reference frame first; the node may also be deliberately avoiding the region because it does not meet the correction criteria.

Level Fill Related Nodes

Go back to the extension to check out more related nodes.
ainvfx-paintaplate
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.

Level Fill