Author: PixelaiLabs.Com
A professional paint editor node that provides MS Paint-like editing capabilities directly within ComfyUI workflows. Load images, draw on them with precision tools, and output both edited images and masks for advanced image processing.
- Image Loading: Load images directly from ComfyUI's input directory
- Interactive Drawing: Full-featured paint editor in a popup window
- High Precision: Maintains original image quality and resolution
- Mask Generation: Automatic mask creation from enclosed drawing areas
- Seamless Integration: Direct integration with ComfyUI workflows
- Variable Brush Size: 1-100px brush sizes with real-time preview
- Color Picker: Full color selection with hex color support
- Undo/Redo: Complete drawing history with keyboard shortcuts (Ctrl+Z/Y)
- Clear All: Reset to original image with confirmation
- Save System: Non-destructive editing with instant preview
- Touch Support: Works on tablets and touch devices
- Smart Scaling: Large images are visually scaled while maintaining full resolution
- Mask Detection: Automatically detects enclosed areas for masking
- Real-time Updates: Instant preview of changes in ComfyUI
- Create the directory structure:
ComfyUI/custom_nodes/paint_editor/
├── __init__.py
└── web/
└── paint_editor.js
-
Copy the files:
- Save the provided Python code as
__init__.py
- Save the JavaScript code as
web/paint_editor.js
- Save the provided Python code as
-
Restart ComfyUI:
- Completely restart your ComfyUI instance
- The node will appear in the "image" category
cd ComfyUI/custom_nodes/
git clone https://github.com/Pixelailabs/paint_editor.git
-
Add the Node: Find "🎨 Paint Editor" in the image category and add it to your workflow
-
Load an Image: Place your images in
ComfyUI/input/
directory and select from dropdown -
Open Paint Editor: Click the "🎨 Open Paint Editor" button - a new window opens with your image
-
Draw and Edit: Use brush tools, adjust size and color, use undo/redo for precision
-
Save and Apply: Click "💾 Save & Close" when finished, then execute the node
- Copy your images to:
ComfyUI/input/your_image.jpg
- In the node, select your image from the dropdown
- The image is now ready for editing
- Click "🎨 Open Paint Editor"
- Use toolbar controls:
- Brush Size: Adjust with slider (1-100px)
- Color: Click color picker to choose
- Undo/Redo: Use buttons or Ctrl+Z/Y
- Draw directly on the image
- Save changes when complete
The Paint Editor node provides two outputs:
- Type: ComfyUI IMAGE tensor
- Quality: Maintains original image resolution and quality
- Format: RGB image with all your drawings applied
- Usage: Connect to any node that accepts IMAGE input
- Type: ComfyUI MASK tensor
- Content: White areas = enclosed regions, Black areas = background
- Detection: Automatically finds areas completely surrounded by drawings
- Usage: Perfect for inpainting, background removal, object selection
Tool | Range | Description |
---|---|---|
Brush Size | 1-100px | Variable brush size with real-time feedback |
Color Picker | Full spectrum | Choose any color for drawing |
Opacity | Automatic | Smooth brush strokes with natural blending |
Button | Shortcut | Function |
---|---|---|
↶ Undo | Ctrl+Z | Undo last drawing action |
↷ Redo | Ctrl+Y | Redo previously undone action |
🗑️ Clear All | - | Reset to original image |
💾 Save & Close | - | Apply changes and return to ComfyUI |
❌ Cancel | - | Discard changes and close |
[Paint Editor] → [Edited Image] → [Inpainting Node]
→ [Drawn Mask] ────┘
[Paint Editor] → [Drawn Mask] → [Mask Operations] → [Background Removal]
[Paint Editor] → [Edited Image] → [Image Enhancement] → [Final Output]
- Draw Outline: Create a closed loop around your subject
- Automatic Detection: Node automatically detects enclosed area
- Mask Output: Use the mask for selective editing
- Apply Effects: Use mask with other nodes for targeted effects
- Continuous Lines: Ensure your outline forms a complete loop
- Zoom Control: Use browser zoom for precision on detailed areas
- Multiple Passes: Draw rough outline first, then refine with undo/redo
- Quality Check: Execute node to verify mask quality before proceeding
- Full Resolution: Canvas maintains original image resolution
- Display Scaling: Large images are scaled for comfortable editing
- Quality Preservation: No quality loss during editing process
- Precision Drawing: Mouse coordinates mapped accurately to full resolution
- Non-Destructive: Original image is never modified
- Session Persistence: Edits are saved until node is reset
- Batch Compatible: Can be used in batch processing workflows
- Memory Efficient: Only stores drawing data, not full images
Issue: Node doesn't appear in ComfyUI
- Solution:
- Verify files are in correct location
- Restart ComfyUI completely
- Check console for error messages
Issue: Paint editor window doesn't open
- Solution:
- Check if popup blocker is enabled
- Ensure image is selected in dropdown
- Try refreshing ComfyUI page
Issue: Drawings don't appear in output
- Solution:
- Click "Save & Close" before executing node
- Verify node execution completed
- Check if image was modified in editor
Issue: Mask output is empty
- Solution:
- Ensure drawn lines form closed loops
- Check brush size isn't too small
- Verify sufficient contrast in drawing
- Large Images: May take longer to load initially
- Complex Drawings: Extensive drawing history may slow undo/redo
- Memory Usage: Close editor window when not in use
- Browser Performance: Use Chrome/Firefox for best compatibility
- ComfyUI: Latest version recommended
- Browser: Chrome, Firefox, Safari, Edge
- Memory: Sufficient RAM for image resolution
- Storage: Space in ComfyUI/input/ directory for images
- Input: PNG, JPG, JPEG, GIF, BMP, WEBP
- Output: High-quality PNG format
- Color Modes: RGB (RGBA converted automatically)
- Resolution: Unlimited (limited by system memory)
The node creates a REST API endpoint:
- POST
/paint_editor/save
- Saves edited image data
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request with detailed description
This project is licensed under the MIT License. Feel free to use in personal and commercial projects.
- Author: PixelaiLabs.Com
- ComfyUI community for the excellent framework
- Contributors and testers
- Users providing feedback and suggestions
Happy Painting! 🎨
Created with ❤️ by PixelaiLabs.Com