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: ExtendCanvasV2

LayerUtility: ExtendCanvasV2 Node Documentation

Overview

The LayerUtility: ExtendCanvasV2 node is a part of the ComfyUI plugin ecosystem, designed to modify the canvas size of an image in a seamless and flexible manner. It provides a way to extend the borders of an image by adding additional pixels with a specified color, which can be useful for design tasks that require precise image alignment or for adding padding to images.

Node Functionality

  • Canvas Extension: The node allows users to extend the canvas of an existing image by specifying the number of pixels to add to the top, bottom, left, and right sides.
  • Color Fill: Users can define a specific color to fill the newly added canvas area.
  • Mask Integration: The node can utilize a mask to define areas that should remain untouched during the extension and can optionally invert this mask.

Input Specifications

The LayerUtility: ExtendCanvasV2 node accepts the following inputs:

  1. Image: The primary image to be processed, which serves as the basis for canvas extension.
  2. Invert Mask: A boolean option that determines if the provided mask should be inverted. This is useful for selectively applying extensions based on mask presence.
  3. Top: An integer specifying the number of pixels to add to the top side of the image. Negative values can potentially crop the image.
  4. Bottom: An integer specifying the number of pixels to add to the bottom side of the image. Negative values can potentially crop the image.
  5. Left: An integer indicating the number of pixels to add to the left side. Similarly, negative values may crop this side.
  6. Right: An integer indicating the number of pixels to add to the right side. Negative values may crop the image from this side as well.
  7. Color: A color value in string format (hexadecimal) specifying the fill color for the extended canvas area.
  8. Mask (Optional): An optional mask input that determines regions of the image to be preserved or considered during extension.

Output Specifications

The node produces the following outputs:

  1. Image: The resulting image with the extended canvas based on the input parameters.
  2. Mask: A mask output reflecting changes applied during the canvas extension process, which can be further utilized in other nodes for advanced editing or processing.

Usage in ComfyUI Workflows

The LayerUtility: ExtendCanvasV2 node is particularly valuable in workflows where image preparation and alignment are critical. It can be integrated into design and editing pipelines to:

  • Add uniform padding around images for aesthetic or functional purposes.
  • Align multiple images by adjusting canvas sizes to a common dimension.
  • Facilitate transformations and juxtapositions of different image layers by extending canvases in controlled increments.

Special Features and Considerations

  • Dynamic Mask Handling: This node offers flexibility by allowing the use of masks to control which parts of the image are extended or protected. This includes the ability to invert the mask, providing versatility in customization.
  • Batch Processing: The node is capable of handling multiple images in a batch, making it efficient for processing large volumes of images at once, as it applies the same extension parameters across a series of images.
  • Edge Restrictions: It is important to note that specifying negative values for the extension parameters can lead to cropping instead of extension, which should be used cautiously based on the desired outcome.

Incorporating the LayerUtility: ExtendCanvasV2 node into your ComfyUI workflows can significantly enhance your ability to manage image canvases with precision and ease, providing a robust tool for various image editing needs.