ComfyUI Extension: ComfyUI APZmedia PSD Tools
This extension provides PSD layer saving functionalities with mask support for ComfyUI.
Custom Nodes (0)
README
ComfyUI APZmedia PSD Tools
Custom ComfyUI nodes for seamless PSD file integration with Photoshop. Save and load images as PSD layers with mask support.
Features
- Multi-layer PSD Creation: Save 1-10 images as separate layers in a single PSD file
- PSD Layer Loading: Extract specific layers and masks from existing PSD files
- Mask Support: Apply masks to individual layers with automatic canvas positioning
- Flexible Inputs: All layer inputs are optional - connect only what you need
- Auto-dependency Installation: Dependencies install automatically on first load
Installation
-
Copy to ComfyUI custom nodes directory:
ComfyUI/custom_nodes/APZmedia-ComfyUI-PSDtools/ -
Restart ComfyUI
Dependencies will install automatically. If installation fails, see troubleshooting.
Nodes
APZmedia PSD Multilayer Saver
Category: image/psd
Saves up to 10 images as layers in a PSD file.
Inputs (all optional):
output_dir(STRING): Output directory (default: "./output")filename_prefix(STRING): Filename prefix (default: "output")layer1-layer10(IMAGE): Images for each layermask1-mask10(MASK): Masks for each layerlayer_name1-layer_name10(STRING): Custom layer names
Outputs: None (writes to disk)
APZmedia PSD Layer Loader
Category: image/psd
Loads PSD files and extracts specific layers.
Inputs:
psd_file(STRING): Path to PSD filelayer_index(INT): Layer index to extract (0-based)load_mask(COMBO): Load mask ("true"/"false", default: "true")
Outputs:
image(IMAGE): Extracted layermask(MASK): Layer masklayer_name(STRING): Layer namelayer_count(INT): Total layers in PSD
Usage Examples
Basic Multi-layer Saving
- Connect images to
layer1,layer2, etc. - Set custom layer names: "Background", "Character", "Effects"
- Add masks if needed
- Run workflow to create PSD
Loading PSD Files
- Set PSD file path
- Select layer index (0-based)
- Choose whether to load mask
- Use extracted image and mask in workflow
Mask Extraction
The loader uses a sophisticated multi-method approach:
- Mask Object Extraction: Primary method for PSD layer masks
- Alpha Channel Extraction: Fallback for transparency-based masks
- Channel Data Extraction: Advanced fallback for complex PSD structures
Canvas Positioning: Automatically handles mask positioning to match full image dimensions.
Troubleshooting
Common Issues
"No layers or masks are being saved"
- Connect at least one layer input
"Failed to save PSD file"
- Check output directory permissions
- Ensure sufficient disk space
"Layer index out of range"
- Verify layer index is within valid range (0 to layer_count-1)
Dependencies not installing
- Check internet connection
- Try manual installation:
pip install psd-tools>=1.9.0
Manual Installation
If auto-installation fails:
cd ComfyUI/custom_nodes/APZmedia-ComfyUI-PSDtools/
python install_for_comfyui.py
Technical Details
Dependencies: psd-tools, Pillow, torch, numpy File Format: Adobe Photoshop PSD (CS6+ compatible) Performance: Optimized for ComfyUI tensor operations
License
MIT License - see LICENSE for details.
Changelog
v0.2.1
- Simplified to essential nodes only
- Removed pytoshop dependency
- Improved mask handling with PIL compositing
- Enhanced error handling and auto-installation
For support, open an issue on GitHub.