Files
2026-01-26 18:20:21 -05:00

129 lines
3.7 KiB
Markdown

# ComfyUI Setup Guide
This repository is designed to work out-of-the-box with ComfyUI as a custom node.
## Installation
### Option 1: Clone directly into ComfyUI (Recommended)
```bash
cd ComfyUI/custom_nodes/
git clone https://github.com/rockerBOO/pixel-sorting.git
cd pixel-sorting
pip install -e .
```
### Option 2: Manual installation
1. Download or clone this repository
2. Copy the entire `pixel-sorting` folder to `ComfyUI/custom_nodes/`
3. Install dependencies:
```bash
cd ComfyUI/custom_nodes/pixel-sorting
pip install -e .
```
### Option 3: Using ComfyUI Manager
*(If this node is registered with ComfyUI Manager)*
1. Open ComfyUI
2. Go to Manager
3. Search for "Pixel Sorting"
4. Click Install
## Available Nodes
Once installed, you'll find these nodes in ComfyUI:
### Pixel Sorting (PixelSorting)
**Category:** `image/effects`
Applies pixel sorting effects to images.
**Inputs:**
- `image` (required) - Input image
- `interval` (required) - How to define sorting intervals
- Options: threshold, bright, dark, white, black, random, waves, edges, none
- `sorting` (required) - How to sort pixels within intervals
- Options: lightness, hue, saturation, intensity, minimum, value
- `angle` (optional) - Rotation angle in degrees (default: 0)
- `randomness` (optional) - Skip percentage 0-100 (default: 0)
- `char_length` (optional) - Interval width for random/waves (default: 50)
- `loops` (optional) - Number of passes (default: 1)
- `bright_value` (optional) - Threshold for bright mode 0-255 (default: 127)
- `dark_value` (optional) - Threshold for dark mode 0-255 (default: 223)
- `lower_threshold` (optional) - Lower threshold 0-1 (default: 0.25)
- `upper_threshold` (optional) - Upper threshold 0-1 (default: 0.8)
**Output:**
- `IMAGE` - Sorted image
### Pixel Sort Analyze (PixelSortAnalyze)
**Category:** `image/analysis`
Analyzes an image and outputs suggested threshold values.
**Inputs:**
- `image` (required) - Input image
**Outputs:**
- `bright_subtle` (INT) - Suggested bright threshold (top 25%)
- `bright_moderate` (INT) - Suggested bright threshold (top 50%)
- `dark_subtle` (INT) - Suggested dark threshold (bottom 25%)
- `dark_moderate` (INT) - Suggested dark threshold (bottom 50%)
## Usage Tips
1. **Start with analysis:** Use the `PixelSortAnalyze` node first to get recommended threshold values for your image
2. **Connect outputs:** Connect the analyze node outputs directly to the sorting node parameters
3. **Experiment:** Try different combinations of interval and sorting modes
4. **Subtle effects:** Start with lower values and increase gradually
5. **Diagonal sorting:** Use angle=45 or angle=90 for interesting effects
## Example Workflows
### Basic Workflow
```
Image Input → PixelSorting (interval=bright, sorting=value) → Preview
```
### Analyzed Workflow
```
Image Input → PixelSortAnalyze
↓
bright_subtle → PixelSorting (interval=bright, sorting=hue)
↓
Preview
```
### Creative Effects
```
Image Input → PixelSorting (interval=random, sorting=hue, char_length=100, randomness=20) → Preview
```
## Troubleshooting
**Nodes don't appear:**
1. Make sure you installed dependencies: `pip install -e .` in the pixel-sorting directory
2. Restart ComfyUI completely
3. Check the console for error messages
**Import errors:**
- Ensure Pillow is installed: `pip install pillow`
- Make sure you're using Python 3.10+
**Poor results:**
- Use the Analyze node first to find good thresholds for your specific image
- The default values (especially dark=223) often don't work well - use analyzed values instead
## Uninstallation
1. Delete the `pixel-sorting` folder from `ComfyUI/custom_nodes/`
2. Restart ComfyUI