ComfyUI Node: Image Mesh Drag

Class Name

ImageMeshDrag

Category
image/perturb
Author
ttulttul (Account age: 5304days)
Extension
ComfyUI-FlowMatching-Upscaler
Latest Updated
2025-12-18
Github Stars
0.05K

How to Install ComfyUI-FlowMatching-Upscaler

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

Applies cloth-like mesh warp to images, creating smooth, dynamic distortions for artistic effects.

Image Mesh Drag:

The ImageMeshDrag node is designed to apply a dynamic, cloth-like mesh warp to an image, creating visually intriguing distortions by randomly dragging a subset of control vertices across the image. This node operates directly in image space, meaning it manipulates the image at the pixel level, allowing for precise and creative alterations. The primary goal of this node is to provide artists with a tool to introduce controlled randomness and organic deformations into their images, enhancing the visual complexity and artistic expression. By leveraging a mesh-based approach, the node ensures that the deformations are smooth and natural, akin to the way fabric might be pulled and stretched. This makes it particularly useful for generating unique textures or adding a sense of movement and fluidity to static images.

Image Mesh Drag Input Parameters:

image

The image parameter is the input image that you wish to warp. It must be provided as a torch.Tensor in either the BHWC (Batch, Height, Width, Channels) or NCHW (Batch, Channels, Height, Width) format. This parameter is crucial as it serves as the canvas for the mesh drag operation, and the quality and format of the image can significantly impact the final output.

seed

The seed parameter is an integer that controls the randomness of the mesh drag operation. By setting a specific seed, you can ensure that the same random points are dragged in the same way each time, allowing for reproducibility of results. The default value is 0, with a minimum of 0 and a maximum of 18,446,744,073,709,551,615. This parameter is essential for achieving consistent results across different runs.

points

The points parameter specifies the number of mesh vertices to randomly drag. It is an integer with a default value of 12, a minimum of 0, and a maximum of 4096. Increasing the number of points will result in more complex and detailed deformations, while fewer points will produce simpler, broader distortions.

drag_min

The drag_min parameter defines the minimum distance, in pixels, that a mesh vertex can be dragged. It is a float with a default value of 0.0, a minimum of 0.0, and a maximum of 4096.0. This parameter sets the lower bound for the extent of the deformation, ensuring that even the smallest drags have a noticeable effect.

drag_max

The drag_max parameter sets the maximum distance, in pixels, that a mesh vertex can be dragged. It is a float with a default value of 32.0, a minimum of 0.0, and a maximum of 4096.0. This parameter determines the upper limit of the deformation, allowing for dramatic and pronounced distortions when set to higher values.

displacement_interpolation

The displacement_interpolation parameter determines the method used to interpolate the displacement of the mesh vertices. The default option is "bicubic," which provides smooth and high-quality results. This parameter affects the smoothness and quality of the deformations, with different interpolation methods offering varying levels of detail and sharpness.

spline_passes

The spline_passes parameter is an integer that specifies the number of passes for spline interpolation. The default value is 2. This parameter influences the smoothness of the mesh deformation, with more passes resulting in smoother transitions between dragged points.

sampling_interpolation

The sampling_interpolation parameter defines the method used for sampling the image during the warp process. The default option is "bilinear," which balances quality and performance. This parameter affects the final appearance of the warped image, with different methods offering varying levels of detail and smoothness.

Image Mesh Drag Output Parameters:

image

The output image is the warped version of the input image, returned as a torch.Tensor in the same format as the input. This output reflects the applied mesh drag operation, showcasing the deformations and distortions introduced by the node. The output image retains the original dimensions of the input, ensuring that only the content is altered while the overall structure remains intact.

Image Mesh Drag Usage Tips:

  • To achieve consistent and reproducible results, use the same seed value across different runs. This ensures that the random mesh points are dragged in the same way each time.
  • Experiment with different points, drag_min, and drag_max values to explore a wide range of deformation effects. Higher values for points and drag_max can create more complex and dramatic distortions.
  • Adjust the displacement_interpolation and sampling_interpolation methods to fine-tune the quality and smoothness of the deformations. Different interpolation methods can produce varying visual effects.

Image Mesh Drag Common Errors and Solutions:

IMAGE input must be a torch.Tensor, got <type>

  • Explanation: This error occurs when the input image is not provided as a torch.Tensor. The node expects the image in a specific tensor format.
  • Solution: Ensure that the input image is converted to a torch.Tensor before passing it to the node. Use appropriate libraries or functions to handle this conversion.

Unable to infer channel axis for image tensor. Expected channels-last (B,H,W,C) or channels-first (B,C,H,W) with C in {1,3,4}, got shape <shape>

  • Explanation: This error indicates that the input image tensor does not have a recognizable channel format. The node requires the image to be in either BHWC or NCHW format.
  • Solution: Verify the shape of the input image tensor and ensure it conforms to one of the expected formats. Adjust the tensor dimensions if necessary to match the required format.

Image Mesh Drag Related Nodes

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