A set of nodes for ComfyUI that can composite layer and mask to achieve Photoshop like functionality.
The LayerUtility: XY to Percent node is part of the ComfyUI_LayerStyle toolkit, designed to facilitate image processing workflows within the ComfyUI framework. This node is used to convert Cartesian coordinates (X, Y) based on pixel positioning into percentage-based coordinates relative to the size of a background image. This helps in positioning overlay images accurately in dynamic layouts or scalable environments.
The node's primary function is to calculate the percentage-based position of a layer image on a background image from given Cartesian coordinates. These percentage values enable adaptable and responsive positioning of images, which can be particularly useful in dynamic rendering or when creating layers in vector-based user interfaces.
The LayerUtility: XY to Percent node requires the following inputs:
background_image: The primary image canvas on which the layer image will be positioned. This input is essential for determining the relative position percentages.
layer_image: The image to be positioned on top of the background. The size of this image is taken into account when calculating the percentage position to ensure its center is aligned based on the given coordinates.
x (Integer): The horizontal coordinate in pixel units. It determines how far the layer image is placed from the left edge of the background image. Default is 0, but it can be adjusted within an extensive range using positive or negative values.
y (Integer): The vertical coordinate in pixel units. It determines how far the layer image is placed from the top edge of the background image. Similar to the 'x' input, this can also be adjusted within a wide range with positive or negative values.
Upon execution, the node produces two output values:
x_percent: A floating-point number representing the horizontal positioning of the layer image as a percentage of the background image’s width.
y_percent: A floating-point number representing the vertical positioning of the layer image as a percentage of the background image’s height.
These percentage values are useful for positioning and layout adjustments across different screen sizes or resolutions.
The LayerUtility: XY to Percent node is an essential tool in workflows that involve composite imagery or require dynamic overlay of images. It can be particularly advantageous in cases where:
By integrating this node into a ComfyUI workflow, users can move from pixel-specific layouts to more flexible, percentage-based designs. This can enhance layout adaptability when scaling designs to fit different screen sizes.
Understanding how to use this node effectively within ComfyUI can greatly enhance the flexibility and scalability of image manipulation projects. This node serves as a valuable tool in any workflow requiring precise and adaptable layer positioning.