PSD Layer Splitter
Turning a Photoshop File Into Something ComfyUI Can Actually Touch
- images
- masks
- layer_names
- layer_count
- output_folder
A .psd is the one image format ComfyUI will not open on its own - it's a proprietary layer container, and the UI wants pixels. This node is the front door of the pack's whole PSD toolkit: it rasterizes every layer of a Photoshop file into its own PNG, writes a _manifest.json capturing where each layer sat, and hands you a folder that every other PSD node in the pack reads back. Split once, then iterate on the layers without re-parsing the PSD.
How it works
Under the hood it uses psd-tools, the third-party parser that's the only realistic way to read Adobe's closed format on a machine without Photoshop. For each layer it renders a PNG (the filename encodes index, total count, layer kind, and name - so a single file tells you how many layers the document has), and the manifest records position, size, opacity, blend mode, visibility, and group path. That manifest is the backbone: the compositor, the background detector, and the flatten nodes all read it to reconstruct the stack.
Two decisions on the splitter shape everything downstream:
layer_sizing-cropped(default) saves each layer at its own bounds only;canvasplaces each layer on the full document canvas at its real position. Cropped is smaller and faster; canvas is what you want if you'll feed layers straight into something that expects full-frame images.layer_types- comma-separated kinds to extract, defaultpixel,type,shape,smartobject,fill. Adjustment layers are left out by default (they affect the stack below them, and rasterizing them as standalone layers misrepresents their effect). Note the tooltip's warning:groupis deliberately not in the default list - groups are handled byextract_groups, off by default, because exporting a group and its children produces duplicates that cover the children when you recomposite.
Inputs and outputs that matter
psd_path (the file) and output_dir (where the PNGs and manifest go) are the two you always set. include_hidden (default off) - include layers the PSD marks hidden; handy for poking at disabled layers, but turn it back off before recompositing or you'll see things that were supposed to stay hidden. overwrite (default on) lets re-runs refresh the folder.
Outputs: images (list of layer RGB images), masks (per-layer alpha, white = transparent - the inverted convention this pack uses), layer_names, layer_count, and output_folder, which you chain straight into the PSD Layer Loader or Compositor. It's an output node, so it also reports to the UI.
Installing it
Part of TrentNodes; one install:
cd ComfyUI/custom_nodes
git clone https://github.com/TrentHunter82/TrentNodes.git
cd TrentNodes
pip install -r requirements.txt
ComfyUI Manager ("Trent Nodes") also works, with the standing caveat that the author renamed the repo on day one, leaving two registry entries that make Manager occasionally flag the pack as "unsafe" - the clone above is the reliable path. psd-tools (the actual PSD parser) is in requirements.txt.
Where people get burned
- Recomposited layers doubled up - that's
extract_groupsleft on. Keep it off unless you specifically want group rasters. - Hidden layers appearing -
include_hiddenis on from a previous experiment. - Index drift - the moment you change
layer_types, indices shift (because adjustment and group layers are filtered in or out). Re-run the whole chain after changing filters, or the indices in your downstream nodes will point at the wrong layers.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| psd_path | STRING | Absolute path to the .psd file | |
| output_dir | STRING | Directory to save extracted layer PNGs and manifest | |
| layer_sizing | COMBO | cropped | cropped = layer bounds only. canvas = placed on full PSD canvas at correct position |
| layer_types | STRING | pixel,type,shape,smartobject,fill | Comma-separated layer kinds to extract: pixel, type, shape, smartobject, fill, adjustment. Note: 'group' is handled by extract_groups (off by default) because exporting both a group and its children produces duplicate layers and shifts indices. |
| include_hiddenopt | BOOLEAN | false | Include layers marked as hidden in the PSD |
| extract_groupsopt | BOOLEAN | false | If True, also rasterize Group nodes as their own layer. Off by default because the group's children are already exported individually, so including the group produces a duplicate that covers the children when recomposited. |
| save_manifestopt | BOOLEAN | true | Save _manifest.json alongside the PNGs with full metadata |
| overwriteopt | BOOLEAN | true | Overwrite existing files in the output directory |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | Each extracted layer as an RGB image |
| masks | MASK | Alpha mask per layer (inverted: white = transparent) |
| layer_names | STRING | Original layer names |
| layer_count | INT | Number of extracted layers |
| output_folder | STRING | Path to the output folder (chain to PSD Layer Loader) |