ComfyUI-AutoSplitGridImage

ComfyUI-AutoSplitGridImage
★ 43

图像分割边缘检测网格切分ComfyUI自定义节点
智能网格图片切分节点,列方向可用边缘检测、行方向可用均匀分割,支持自定义行列数、预览网格并输出各单元,自动调整为偶数尺寸
💡 对图片进行智能网格切分并输出预览与单元图
🍴 3 Forks💻 Python🔄 2025-01-06
📦
网盘下载
复制链接后前往夸克网盘下载
https://pan.quark.cn/s/9d76119b2ef2
📦 requirements.txt
numpy>=1.21.0
opencv-python>=4.5.0
pillow>=8.0.0
torch>=1.7.0
example_workflow
example_png
example_png
📄 README

ComfyUI-AutoSplitGridImage

ComfyUI-AutoSplitGridImage is a custom node for ComfyUI that provides flexible image splitting functionality. It allows users to choose between edge detection and uniform division for both row and column splits, offering a customizable approach to grid-based image segmentation.

Features

  • Customizable splitting methods for both rows and columns
  • Choice between edge detection and uniform division for each axis
  • Adjustable number of rows and columns
  • Preview image with grid lines
  • Outputs both the preview image and individual grid cells
  • Automatic even dimension resizing with EvenImageResizer node
  • Installation

  • Clone this repository into your ComfyUI custom_nodes directory:
  • “`

    cd /path/to/ComfyUI/custom_nodes

    git clone https://github.com/yourusername/ComfyUI-AutoSplitGridImage.git

    “`

  • Restart ComfyUI or reload custom nodes.
  • Usage

    GridImageSplitter Node

  • In the ComfyUI interface, find the “GridImageSplitter” node under the “image/processing” category.
  • Connect an image output to the “image” input of the GridImageSplitter node.
  • Set the desired number of rows and columns.
  • Choose the splitting method for rows and columns (uniform or edge detection).
  • The node will output two images:
  • A preview image showing the grid lines
  • A tensor containing all the split image cells
  • EvenImageResizer Node

  • Find the “EvenImageResizer” node under the “image/processing” category.
  • Connect an image output to the “image” input.
  • The node will automatically ensure the output image has even dimensions by trimming if necessary.
  • Parameters

    GridImageSplitter

  • image: Input image to be split
  • rows: Number of rows to split the image into (default: 2, range: 1-10)
  • cols: Number of columns to split the image into (default: 3, range: 1-10)
  • row_split_method: Method to split rows (“uniform” or “edge_detection”)
  • col_split_method: Method to split columns (“uniform” or “edge_detection”)
  • EvenImageResizer

  • image: Input image to be processed
  • How It Works

  • Uniform Splitting: Divides the image into equal parts along the specified axis.
  • Edge Detection Splitting: Uses OpenCV’s Canny edge detection to find natural splitting points in the image.
  • Even Dimension Resizing: Automatically trims images to ensure both width and height are even numbers.
  • Contributing

    Contributions are welcome! Please feel free to submit a Pull Request.

    License

    This project is licensed under the Apache License 2.0 License – see the LICENSE file for details.

    Acknowledgements

  • This project is designed to work with ComfyUI.
  • Edge detection is implemented using OpenCV.