Ir para o conteúdo
Node packVerificadoExterno
Fonte aberta

fit-mask-to-image

ComfyUI node for fitting masks to image dimensions with automatic batch size adjustment

TarefasEdição de imagemMantenedor@DazzleNodesUnratednota

Perfil do pacote

Status
Verificado
Publicador
@DazzleNodes
Fonte
GitHub

README

ComfyUI Fit Mask to Image

Python 3.10+ ComfyUI Registry GitHub release License: MIT

Automatically resizes masks to match image dimensions for seamless inpainting workflows. Replaces a 10-node workflow chain with a single, efficient node.

Overview

This node solves a common inpainting problem: when your KSampler output dimensions (i.e. 960x960) no longer match your input (i.e. 958x958) mask dimensions due to the KSampler outputs being divisible by 8. This is also helpful for workflows where masks and images come from different sources or when upscaling changes dimensions.

Features

  • One-Node Solution: Replaces 10-node workflow with single node
  • Smart Dimension Matching: Automatically scales masks to match image dimensions
  • Missing Mask Handling: Auto-generates masks when none provided (default: entire image visible)
  • Multiple Outputs: Fixed mask, preview image, debug mask, and masked latent
  • Inpainting Ready: Direct integration with KSampler via latent output
  • Debug Information: Detailed info output showing dimension changes
  • Nearest-Exact Scaling: Preserves mask quality during resize

Prerequisites

  • ComfyUI installation
  • Python 3.10+ (or ComfyUI's embedded Python)
  • No additional dependencies (uses ComfyUI's PyTorch, PIL, numpy)

Installation

ComfyUI Registry (Recommended - Coming Soon)

The easiest way to install is through the ComfyUI Registry:

  1. Open ComfyUI Manager in your ComfyUI interface
  2. Search for "DazzleNodes" ("Fit Mask to Image" isn't a standalone node)
  3. Click Install and restart ComfyUI

The node will appear under: DazzleNodes → Fit Mask to Image

Alternatively, use the command line:

comfy node install fit-mask-to-image

Git Clone

cd ComfyUI/custom_nodes
git clone https://github.com/DazzleNodes/fit-mask-to-image.git

Then restart ComfyUI or use Manager → Refresh Node Definitions.

Manual Installation

  1. Download the latest release and extract to ComfyUI/custom_nodes/fit-mask-to-image/
  2. Restart ComfyUI
  3. Find the node in: DazzleNodes → Fit Mask to Image

Part of DazzleNodes Collection

This node is also included in the DazzleNodes collection. If you install DazzleNodes, you automatically get this node along with other useful nodes.

Usage

Basic Workflow

  1. Add "Fit Mask to Image" node to your workflow (found under "DazzleNodes")
  2. Connect your source IMAGE (for dimension reference)
  3. Connect your MASK (to fix dimensions)
  4. Set missing_mask parameter (default: pass_through - preserves original behavior)
  5. Optionally connect a LATENT for inpainting workflows

Missing Mask Handling

The missing_mask parameter controls what happens when no mask is connected or mask is empty:

  • pass_through (default): Process empty mask as-is (original behavior)
  • all_visible: Creates white mask (entire image visible)
  • all_hidden: Creates black mask (entire image masked)
  • error: Fails with error message (useful for debugging)

Outputs

  • fixed_mask: Final mask with corrected dimensions (from alpha channel)
  • preview_image: RGB+alpha merged image for visual verification
  • info: Text showing original→target dimensions and processing status
  • masked_latent: Latent with mask applied (if lat

Nós neste pacote

Nó 1
  • FitMaskToImage

Fontes

3 fontes
GitHubFonteVersão 90c959a98570ddff26a625b9164adab1c2c2c7a7
github.com/DazzleNodes/fit-mask-to-image

Verificado 2 de out.

GitHubFonte
github.com/DazzleNodes/fit-mask-to-image

Verificado 1 de out.

Trechos de fonte

1 trecho

Source context: Repo DazzleNodes/fit-mask-to-image