ComfyUI  >  Nodes  >  KJNodes for ComfyUI >  Offset Mask

ComfyUI Node: Offset Mask

Class Name

OffsetMask

Category
KJNodes/masking
Author
kijai (Account age: 2192 days)
Extension
KJNodes for ComfyUI
Latest Updated
6/25/2024
Github Stars
0.3K

How to Install KJNodes for ComfyUI

Install this extension via the ComfyUI Manager by searching for  KJNodes for ComfyUI
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter KJNodes for ComfyUI 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
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Offset Mask Description

Manipulate mask images with offsets, rotations, duplication, and edge wrapping for precise control in AI art projects.

Offset Mask:

The OffsetMask node is designed to manipulate and transform mask images by applying various offsets and rotations. This node allows you to shift the mask horizontally and vertically, rotate it by a specified angle, and duplicate the mask multiple times to create a batch. Additionally, it offers options for edge wrapping and different padding modes, making it a versatile tool for adjusting masks in your AI art projects. By using this node, you can achieve precise control over the positioning and orientation of your masks, which can be particularly useful for complex compositions and effects.

Offset Mask Input Parameters:

mask

The input mask or mask batch that you want to transform. This parameter is essential as it serves as the base image for all subsequent transformations.

x

The horizontal offset to apply to the mask. This value can range from -4096 to the maximum resolution, with a default of 0. Positive values shift the mask to the right, while negative values shift it to the left.

y

The vertical offset to apply to the mask. This value can range from -4096 to the maximum resolution, with a default of 0. Positive values shift the mask downward, while negative values shift it upward.

angle

The angle in degrees to rotate the mask. This value can range from -360 to 360 degrees, with a default of 0. Positive values rotate the mask clockwise, while negative values rotate it counterclockwise.

duplication_factor

The number of times to duplicate the mask to form a batch. This value can range from 1 to 1000, with a default of 1. Increasing this value creates multiple copies of the mask, which can be useful for batch processing.

roll

A boolean parameter that determines whether to apply edge wrapping when the mask is shifted. The default value is False. When set to True, the mask edges will wrap around, creating a continuous effect.

incremental

A boolean parameter that determines whether to apply incremental offsets. The default value is False. When set to True, the offsets will be applied incrementally, which can create a cascading effect.

padding_mode

The padding mode to use when the mask is shifted. Options include 'empty', 'border', and 'reflection', with 'empty' as the default. This parameter determines how the empty spaces created by the shift are filled.

Offset Mask Output Parameters:

mask

The transformed mask or mask batch. This output reflects all the applied offsets, rotations, and duplications, providing you with the final adjusted mask.

Offset Mask Usage Tips:

  • Use the duplication_factor to create multiple copies of a mask for batch processing, which can save time and ensure consistency across multiple images.
  • Experiment with the padding_mode to achieve different visual effects when shifting the mask. For example, 'reflection' can create a mirrored edge, while 'empty' will leave the edges transparent.
  • Utilize the incremental parameter to create dynamic, cascading effects by applying offsets incrementally.

Offset Mask Common Errors and Solutions:

"ValueError: x or y offset out of range"

  • Explanation: The specified x or y offset is beyond the allowable range.
  • Solution: Ensure that the x and y values are within the range of -4096 to the maximum resolution.

"TypeError: mask input is not a valid MASK type"

  • Explanation: The input provided for the mask parameter is not of the expected type.
  • Solution: Verify that the input is a valid mask or mask batch.

"ValueError: angle out of range"

  • Explanation: The specified angle is beyond the allowable range of -360 to 360 degrees.
  • Solution: Adjust the angle value to be within the specified range.

Offset Mask Related Nodes

Go back to the extension to check out more related nodes.
KJNodes for ComfyUI
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.