ComfyUI > Nodes > ComfyUI 1hewNodes > Image Stroke by Mask

ComfyUI Node: Image Stroke by Mask

Class Name

1hew_ImageStrokeByMask

Category
1hewNodes/image
Author
1hew (Account age: 1113days)
Extension
ComfyUI 1hewNodes
Latest Updated
2026-04-17
Github Stars
0.03K

How to Install ComfyUI 1hewNodes

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

Image Stroke by Mask Description

Enhances images by applying customizable strokes around masked areas for emphasis and depth.

Image Stroke by Mask:

The 1hew_ImageStrokeByMask node is designed to enhance images by applying a stroke effect around specified areas defined by a mask. This node is particularly useful for artists who want to highlight or outline certain parts of an image, adding emphasis and depth to their artwork. By utilizing morphological operations, the node creates a stroke around the masked regions, allowing for a customizable stroke width and color. This feature can be applied to batch processes, simplifying workflows and ensuring consistency across multiple images. The primary goal of this node is to provide a straightforward yet powerful tool for adding stylistic strokes to images, enhancing their visual appeal and drawing attention to key elements.

Image Stroke by Mask Input Parameters:

image

The image parameter is a tensor representing the input image to which the stroke effect will be applied. This parameter is crucial as it serves as the base upon which the mask and stroke are overlaid. The quality and resolution of the input image can significantly impact the final output, so it is advisable to use high-quality images for the best results.

mask

The mask parameter is a tensor that defines the areas of the image where the stroke will be applied. This mask acts as a stencil, guiding the node on where to create the stroke. The mask should be a binary image where the areas to be stroked are marked, typically with white, and the rest is black. The accuracy of the mask directly affects the precision of the stroke placement.

stroke_width

The stroke_width parameter determines the thickness of the stroke applied around the masked areas. It is an integer value, and its impact is directly proportional to the visual prominence of the stroke. A larger stroke width will result in a more pronounced outline, while a smaller width will create a subtle effect. The choice of stroke width should align with the desired artistic effect.

stroke_color

The stroke_color parameter specifies the color of the stroke. It can be defined using a string that represents a color name or a specific color code. This parameter allows for creative flexibility, enabling you to choose a color that complements or contrasts with the image, thereby enhancing the overall aesthetic.

Image Stroke by Mask Output Parameters:

stroked_image

The stroked_image is the output parameter that provides the final image with the applied stroke effect. This image retains the original content with the addition of the stroke around the masked areas, resulting in a visually enhanced version of the input image. The output is crucial for evaluating the effectiveness of the stroke application and making any necessary adjustments to the input parameters.

Image Stroke by Mask Usage Tips:

  • Experiment with different stroke_width values to achieve the desired level of emphasis on the masked areas. A thicker stroke can create a bold outline, while a thinner stroke offers a more delicate touch.
  • Use contrasting colors for the stroke_color to make the outlined areas stand out more prominently against the rest of the image, enhancing visual impact.
  • Ensure that the mask accurately represents the areas you wish to highlight. A well-defined mask will result in a cleaner and more precise stroke application.

Image Stroke by Mask Common Errors and Solutions:

Invalid mask format

  • Explanation: This error occurs when the mask provided is not in the expected binary format.
  • Solution: Ensure that the mask is a binary image with clear distinctions between the areas to be stroked and the background.

Stroke width out of range

  • Explanation: The stroke width specified is either too small or too large for the node to process effectively.
  • Solution: Adjust the stroke_width parameter to a reasonable value that fits within the node's operational range, typically between 1 and 10 for most applications.

Unsupported stroke color

  • Explanation: The stroke color provided is not recognized or is in an incorrect format.
  • Solution: Use standard color names or valid color codes to specify the stroke_color, ensuring compatibility with the node's color processing capabilities.

Image Stroke by Mask Related Nodes

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

Image Stroke by Mask