PSD Layer Names
Read a PSD's Layer List Before You Touch It — No Rasterizing
- all_names
- name_at_index
- count
You've got a Photoshop file from a client and you need to swap one layer's artwork - but which layer is the logo, and what is it even called? This node answers that in milliseconds: it walks the PSD's layer tree and lists every layer name, with no rasterization and no manifest side effects. It's the reconnaissance step before PSD Layer Save As PSD, because that node targets layers by name, and names are only useful if you know them.
What it does
Required inputs are psd_path and index (which layer to surface in the name_at_index output - 0 is the bottom). The one optional, include_groups, defaults to off to match the splitter's filtering (groups hidden); flip it on if you specifically want to target a group by name.
The outputs are the whole story:
all_names- a multiline string of every layer name. Wire this into a Show Text node and you have the full inventory of the file.name_at_index- the name at theindexyou set, after the same filtering the splitter uses. This is the value you feed into PSD Layer Save As PSD'starget_layer_name.count- how many layers survived filtering.
That last bit matters more than it looks: because the filtering matches the splitter, the index you type here lines up with the indices the splitter produces. If you've been staring at a splitter manifest, you can cross-reference. If the PSD has groups, remember the default hides them - your count and your splitter output will agree, but neither counts group rows.
The workflow it enables
Discover → target → replace:
- Point this at the PSD, wire
all_namesto a text display, see exactly what's in the file. - Set
indexto the layer you care about, readname_at_index. - Feed that name into PSD Layer Save As PSD, and your replacement lands on the right layer by name - even if the file's layer order changes later, because you matched a name, not a position.
This is the node that makes the save-as node usable at all, honestly. Typing layer names blind into a text box is how you end up replacing the background instead of the logo.
Installing it
Part of TrentNodes; one install covers all of it:
cd ComfyUI/custom_nodes
git clone https://github.com/TrentHunter82/TrentNodes.git
cd TrentNodes
pip install -r requirements.txt
Or ComfyUI Manager, search "Trent Nodes" - with the standing caveat that the author's day-one repo rename left a duplicate registry entry, so Manager occasionally flags the pack as "unsafe" and the manual clone is the reliable fallback. This node uses psd-tools (in requirements) and nothing else - no models, no downloads.
Where it trips people up
Non-Latin layer names are the classic gotcha in PSD tooling, and this is the part of the pack that handles them properly - PSD Layer Save As PSD writes the proper Unicode tagged block so Chinese, Korean, or accented layer names survive. If a name looks wrong or a replacement isn't matching, double-check include_groups is set the way you expect; a group-wrapped layer can hide from the list when groups are off.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| psd_path | STRING | Absolute path to the .psd | |
| index | INT | 00–9999 | Which layer to return in name_at_index (0 = bottom) |
| include_groupsopt | BOOLEAN | false | Match the splitter default: groups hidden. Turn on if you want to target a group by name. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| all_names | STRING | Multiline list of every layer - feed into a Show Text node to see what's in the PSD |
| name_at_index | STRING | The layer name at `index` (after the same filtering PSDLayerSplitter uses). Feed into PSDLayerSaveAsPSD's target_layer_name. |
| count | INT | How many layers the PSD has (after filtering) |