A while ago I posted psdlayerstga 1.0. I have now updated it to support saving to PNG files, which is also now the default output format. The tool also got renamed to psdslayer, since I was constantly imagining, and even mistyping, the name to be “psd slayer” rather than “psd layers“. And I find it funny.
If you’re wondering what is psdslayer, it is simply a small command-line tool which extracts each layer from a .psd file to separate png (or tga) files. It also outputs some meta information about each layer to the console (stdout), or optionally also as part of the file names of exported images. The meta info contains position and size of each layer region, which is hopefully useful for automating some part of a tool pipeline.
Grab the version 1.1 here, including source code and a pre-built executable for Windows:
psdslayer.zip
Disclaimer: Use it for anything, but do so at your own risk.
Update: The PSD reading code is limited and really handles only a small subset of possible things. Here’s hints how to make “compatible” PSD for processing:
- Use “Maximize compatibility” setting when saving PSD files
- Rasterize all special layers to ordinary layers (text, smart objects, layer effects, …)
- Collapse all groups (layer hierarchy should be completely flat)
- Use 8 bit depth per color component (16 bit per component is not supported)
- Remove all layers which contain a “very small” image, e.g. size being just a few pixels (the loader seems to have a bug with handling of these, or perhaps related to reading layers consisting of raw data rather than rle-compressed?)
Update Feb 2010: There’s also a tool called psdparse which does the same task, apparently even more robustly.