Page 1 of 1

Converting PSDs to PNG with layer names intact

Posted: 2010-04-22T11:02:53-07:00
by Figbash
Hello, I'm new to imagemagick and have been poring over the docs to figure this out, but I give up :)

I'm trying to take a source PSD file and export all of it's layers into PNG files, which are titled with the name of the layer. I'm unsure if IM can get Group information from PSDs, but if it can I would also like to have that in the title of the PNG.

So a list of "GroupName-LayerName.PNG" files would be the result.

I see the layername listed as label: in the output from identify verbose, but I'm unsure how to use this in Convert? Anyone know how to do this?

Re: Converting PSDs to PNG with layer names intact

Posted: 2010-04-22T12:00:00-07:00
by fmw42
if it is in the verbose info, then you will likely need to write a script to get the name first and put into a variable, then use convert to extract the layer you want and give the output name according to the variable value you had extracted. You will need to loop over each layer in the image.

can you post a link to a sample pdf with the layer names in the verbose info?

Re: Converting PSDs to PNG with layer names intact

Posted: 2010-04-22T14:17:08-07:00
by Figbash
Here's a file with two layers in it

http://flyingworm.com/TestLayers.psd

Re: Converting PSDs to PNG with layer names intact

Posted: 2010-04-22T15:18:23-07:00
by fmw42
here is how to get the name of the label from a given frame

label=`convert TestLayers.psd[1] -verbose info: | grep "label:" | cut -d: -f 2 | cut -d\ -f2`
echo $label
TestLayer

you just need to find out how many layers

numlayer=`convert TestLayers.psd -format "%[scenes]" info: | head -n 1`
echo $numlayers
3

Then loop through each layer in a script and get the label name and use that in your convert

convert TestLayers.psd[1] TestLayers-${label}.png