2009-10-16

Tool update: psdslayer 1.1


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.

2 responses:

  1. scoopr says:

    I used this commandline for quick’n’dirty compile on osx: g++ -I libpng -Wno-write-strings -O2 -lz libpng/*.c *.cpp *.c -o psdslayer

  2. scoopr says:

    Erm, and on snowleopard you need to add ‘-arch i386’, because the code isn’t 64bit safe

Leave a Reply

Code, Misc.RSS feed for responses —Trackback link.


3rd party advertisement:
(not chosen by me, picked by Google for you)