PSD -> PNG: name output files based on layer name

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Posts: 1
Joined: 2013-02-11T13:02:48-07:00
Authentication code: 6789

PSD -> PNG: name output files based on layer name

Post by architekt »

I've got a PSD that contains some layers. Let's just say they're named "Layer 1", "Layer 2", etc. I would like the resulting output files to be named accordingly, so like "Layer1.png", "Layer2.png". When I use this command:
convert MyPSD[1--1].psd out.png
I instead get files named out-0.png, out-1.png, etc. (as expected). Is there a way to accomplish this? And if not via the command line, would I be able to do this if I used the C++ interface to write my own code? Thanks!

Edit: After much floundering around, I found the solution! Instead of using "out.png" as the destination filename, I used this command:
-set filename:layers %l out-%[filename:layers].png

Now all the files are named "out-<layer name>.png" where <layer name> is, well, the name of the layer saved as an individual file.
Post Reply