LayerStyle

2167
By chflame
Updated 15 days ago
View on GitHub →See Common Issues →

A set of nodes for ComfyUI that can composite layer and mask to achieve Photoshop like functionality.

Available Nodes

LayerUtility: ExtendCanvas

LayerUtility: ExtendCanvas Node Documentation

Overview

The LayerUtility: ExtendCanvas node is a component of the ComfyUI framework, providing functionality to extend the canvas of an image. This tool is particularly useful for manipulating image dimensions by adding extra space around the original image. The new dimensions can be customized with various settings, and the blank spaces can be filled with a specified color. This allows for creative control when preparing images for further processing or presentation.

Functionality

The primary function of the ExtendCanvas node is to expand an image's canvas size by adding optional margins to the top, bottom, left, and right. Users can specify the size of these margins separately for each side. The new canvas space is filled with a color of choice. Additionally, the node can handle image masks, providing versatility in applications where masking is essential.

Inputs

The ExtendCanvas node accepts the following inputs:

  • Image:

    • Type: Image
    • Description: The image you want to extend. This is the primary image input that will be manipulated to include additional canvas space.
  • Invert Mask:

    • Type: Boolean
    • Default: True
    • Description: A toggle to determine if the mask should be inverted. Useful for operations where the mask's areas of effect should be flipped.
  • Top Margin:

    • Type: Integer
    • Default: 0, Range: 0 to 99999
    • Description: Amount of extra space to add to the top of the original image.
  • Bottom Margin:

    • Type: Integer
    • Default: 0, Range: 0 to 99999
    • Description: Size of the margin to add to the bottom of the original image.
  • Left Margin:

    • Type: Integer
    • Default: 0, Range: 0 to 99999
    • Description: Size of the margin to add to the left side of the image.
  • Right Margin:

    • Type: Integer
    • Default: 0, Range: 0 to 99999
    • Description: Size of the margin to add to the right side of the image.
  • Color:

    • Type: Color
    • Default: #000000 (Black)
    • Description: The color used to fill the new canvas area.
  • Mask: (Optional)

    • Type: Mask
    • Description: A mask to apply to the image. When provided, it can affect how the image and the new canvas interact with each other.

Outputs

The ExtendCanvas node produces the following outputs:

  • Image:

    • Description: The newly created image with the extended canvas.
  • Mask:

    • Description: The new mask associated with the image, which reflects the changes made during the canvas extension process.

Usage in ComfyUI Workflows

The ExtendCanvas node is versatile and can be integrated into ComfyUI workflows to achieve various objectives:

  • Image Preparation: Extend an image's canvas to create a buffer space for further image processing tasks.
  • Presentation Enhancement: Add balanced or artistic borders to images by manipulating margin sizes and colors.
  • Mask Adjustment: Use in combination with masks for tasks involving selective image processing or effects application.

Special Features and Considerations

  • Flexible Margins: Each margin can be independently adjusted, allowing for precise control over the canvas extension in any direction.
  • Color Choice: The ability to specify the fill color gives users creative freedom to match or contrast the original image aesthetic.
  • Mask Handling: When combined with masks, the node can produce complex images where certain areas of the canvas extension are more controlled.
  • Batch Processing: The node can process multiple images and corresponding masks efficiently, making it suitable for larger workflows or production environments.

In summary, the LayerUtility: ExtendCanvas node is a powerful tool for expanding images, with a broad range of applications in image manipulation and compositing within the ComfyUI framework.