Any way to save all *.psd layers separately

Does one of you know, what is the best and most comfortable way to parse *.psd file from command-line, get all layers and save them all as, say, *.pngs? Preferably in MacOs, Linux or FreeBSD, but Windows is also OK.


Imagemagick will by default convert a psd to multiple images:

convert file.psd file.png

will result in file-0.png, file-1.png etc for each layer. If you wanted a single image, use the flatten switch:

convert file.psd -flatten file.png

Imagemagick is available on osx, windows and linux. And iOS somehow.