ComfyUI > Nodes > TrentNodes > Latent-Aligned Mask (Wan 2.1)

ComfyUI Node: Latent-Aligned Mask (Wan 2.1)

Class Name

LatentAlignedMaskWan

Category
Trent/Masks
Author
TrentHunter82 (Account age: 0days)
Extension
TrentNodes
Latest Updated
2026-03-20
Github Stars
0.03K

How to Install TrentNodes

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

Latent-Aligned Mask (Wan 2.1) Description

Aligns masks for Wan 2.1 VAE, optimizing expansion and blur for precise latent space fit.

Latent-Aligned Mask (Wan 2.1):

The LatentAlignedMaskWan node is designed to process and align masks specifically for the Wan 2.1 VAE, which utilizes an 8x spatial compression. This node is part of the Trent/Masks category and is tailored to optimize mask processing by adjusting the mask's expansion and blur parameters to fit the latent space effectively. The primary goal of this node is to ensure that masks are accurately aligned with the latent space, enhancing the quality and precision of the generated outputs. By offering preset configurations such as "tight," "standard," and "loose," it provides flexibility and ease of use, allowing you to choose the level of mask expansion and blur that best suits your artistic needs. This node is particularly beneficial for AI artists looking to maintain high fidelity in their work while leveraging the compression capabilities of the Wan 2.1 VAE.

Latent-Aligned Mask (Wan 2.1) Input Parameters:

mask

The mask parameter is the input mask that you wish to process and align with the latent space. This mask serves as the foundation for the node's operations, and its quality and characteristics will directly impact the final aligned mask output. There are no specific minimum or maximum values for this parameter, as it is dependent on the image or data you are working with.

preset

The preset parameter allows you to select from predefined configurations that determine the expansion and blur settings for the mask. The available options are "tight," "standard," "loose," and "custom." Each preset offers a different balance between expansion and blur, with "tight" providing minimal expansion and no blur, "standard" offering moderate expansion and blur, and "loose" providing maximum expansion and blur. The "custom" option allows you to specify your own values for expansion and blur. The default value is "standard."

expansion_pixels

The expansion_pixels parameter specifies the number of pixels by which the mask should be expanded in pixel space. This parameter is particularly relevant when using the "custom" preset, as it allows you to define the exact expansion level. The default value is 64 pixels, and it is divided by the compression factor to determine the expansion in latent space.

blur_pixels

The blur_pixels parameter determines the amount of blur applied to the mask in pixel space. Similar to expansion_pixels, this parameter is most relevant when using the "custom" preset. The default value is 8 pixels, and it is divided by the compression factor to calculate the blur in latent space.

Latent-Aligned Mask (Wan 2.1) Output Parameters:

aligned_mask

The aligned_mask output is the processed mask that has been aligned with the latent space. This output is crucial for ensuring that the mask fits well within the compressed latent space, maintaining the integrity and quality of the mask in the final output. The aligned mask is a refined version of the input mask, adjusted according to the selected preset or custom settings.

Latent-Aligned Mask (Wan 2.1) Usage Tips:

  • To achieve the best results, choose the preset that closely matches your artistic goals. For precise and detailed work, the "tight" preset may be ideal, while the "loose" preset can be useful for more abstract or broad applications.
  • When using the "custom" preset, experiment with different values for expansion_pixels and blur_pixels to find the perfect balance for your specific project. Keep in mind that these values are divided by the compression factor to determine their effect in latent space.

Latent-Aligned Mask (Wan 2.1) Common Errors and Solutions:

"KeyError: 'preset_name'"

  • Explanation: This error occurs when an invalid preset name is provided. The node expects one of the predefined preset names: "tight," "standard," "loose," or "custom."
  • Solution: Ensure that the preset name you provide matches one of the available options exactly. Double-check for any typos or incorrect casing.

"TypeError: unsupported operand type(s)"

  • Explanation: This error may arise if non-numeric values are provided for expansion_pixels or blur_pixels when using the "custom" preset.
  • Solution: Verify that the values for expansion_pixels and blur_pixels are numeric and within a reasonable range for your project.

Latent-Aligned Mask (Wan 2.1) Related Nodes

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

Latent-Aligned Mask (Wan 2.1)