2.9 KiB
2.9 KiB
Image Processing Suite for ComfyUI
A collection of specialized image processing nodes for ComfyUI, focused on dataset preparation and pixel art manipulation.
Installation
- Create a
custom_nodesdirectory in your ComfyUI installation if it doesn't exist - Clone this repository inside the
custom_nodesdirectory:
cd custom_nodes
git clone [repository_url] image_processing
- Restart ComfyUI
Nodes
Load Images (Original Size)
Loads all images from a directory while preserving their original dimensions.
Inputs:
directory: Path to the directory containing images
Outputs:
- List of images in their original sizes
Features:
- Preserves original image dimensions
- Compatible with ComfyUI's RebatchImages node
- Supports common image formats (png, jpg, jpeg, bmp, webp)
Custom Crop
Crops images with specific positioning options.
Inputs:
image: Input imagecrop_width: Width of crop areacrop_height: Height of crop areacrop_mode: Cropping position ("center", "left", "right", "top", "bottom")
Outputs:
- Cropped image
Smart Resize
Resizes images to a target size while intelligently filling missing areas.
Inputs:
image: Input imagetarget_size: Desired sizeborder_sample_size: Pixels to sample for border colorcolor_method: Method to determine fill color ("mean" or "mode")
Outputs:
- Resized image with intelligent border filling
Nearest Neighbor Upscale
Performs upscaling using nearest neighbor interpolation, perfect for pixel art.
Inputs:
image: Input imagescale_factor: Multiplication factor for upscaling (1-8)
Outputs:
- Upscaled image without interpolation artifacts
Pixel Art Normalizer
Normalizes images into pixel art style with consistent grid sizes.
Inputs:
image: Input imageblock_size: Size of pixel blocks (0 for auto-detection)n_colors: Number of colors in output (0 for auto-detection)
Outputs:
normalized: Normalized pixel art image at original sizeblock_size: Detected/used block sizedownscaled: 1:1 pixel art version (downscaled by block size)
Features:
- Automatic grid size detection
- Color quantization
- Outputs both full-size and true 1:1 pixel art versions
Usage Examples
Basic Image Loading and Batching
LoadImagesOriginal -> RebatchImages -> [Further Processing]
Pixel Art Creation Pipeline
LoadImagesOriginal -> PixelArtNormalizer -> NearestUpscale
Dataset Preparation
LoadImagesOriginal -> CustomCrop -> SmartResize -> [Training]
Dependencies
- NumPy
- OpenCV (cv2)
- scikit-learn
- PIL
- PyTorch (provided by ComfyUI)
Notes
- All nodes maintain compatibility with ComfyUI's native nodes
- Images are handled in RGB format
- All operations preserve proper normalization (0-1 range)
Contributing
Feel free to open issues or submit pull requests for improvements.
License
[Your chosen license]