We have a script which breaks a Photoshop PSD file into its three layers as PNG images, using the ImageMagick "convert" command:
convert my.psd -set dispose Background -coalesce -delete 0 temp.png
It's just like the answer to the SO question Extract layers from PSD with ImageMagick, preserving layout. We do want to see the output images aligned as in that question.
It works fine except sometimes when the middle layer is empty, that is, completely transparent. In this case it behaves as if that layer is missing, and produces PNG files for the other two layers only. How can I get all the layers?
I've been sifting through the ImageMagick documentation, trying variations on the options above, but no luck so far.
I'm on OS X 10.7.4.
$ convert -version
Version: ImageMagick 6.7.9-0 2012-08-27 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenCL