modifying layer names when writing PSD

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
User avatar
keithfm1
Posts: 2
Joined: 2013-10-31T20:59:17-07:00
Authentication code: 6789

modifying layer names when writing PSD

Post by keithfm1 »

Hello,

I am trying to take multiple images and add them as layers to a PSD file with ImageMagick, BUT be able to modify the layer names. The first part of this works just fine, though the layers seem to automatically be named L000001, L000002, etc. I would like to store the original image names as the layer names. Is this possible?

Many thanks in advance!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: modifying layer names when writing PSD

Post by fmw42 »

I do not think this is possible with IM. But I am no expert on PSD files.

I tried this, but the layers are still as you listed them.


convert rose: -set comment "rose1" rose1.png
convert rose: -set comment "rose2" rose2.png
convert rose: -set comment "rose3" rose3.png
convert rose1.png rose2.png rose3.png rose.psd

Perhaps someone else might know of a way or can say definitively one way or the other.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: modifying layer names when writing PSD

Post by snibgo »

I don't use PSD, but I think it might be done with "-label".
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: modifying layer names when writing PSD

Post by fmw42 »

snibgo wrote:I don't use PSD, but I think it might be done with "-label".
Good idea, snibgo.

This seems to work, but I had to duplicate the first image for the "flattened" layer; otherwise it is not listed in layers. But the label does get assigned to the layers.


convert rose: -set label "rose1" rose1.png
convert rose: -set label "rose2" rose2.png
convert rose: -set label "rose3" rose3.png
convert rose1.png rose1.png rose2.png rose3.png rose.psd
User avatar
keithfm1
Posts: 2
Joined: 2013-10-31T20:59:17-07:00
Authentication code: 6789

Re: modifying layer names when writing PSD

Post by keithfm1 »

Hey guys, thanks very much for the solution! One question (and forgive me as I'm a complete imagemagick newbie) but is the 'rose:' in your command meant to operate on an internal image that has already been read in? I ask because interestingly enough, when I utilize the code snippet as-is with 'rose:' it simply works:

> convert rose: -set label "my label foo blah" color.0001.tif
> identify +ping -format '"%l"\n' color.0001.tif
//returns "my label foo blah"

Yet if I try any other string for that initial image setting, the command simply hangs indefinitely:
> convert foo: -set label "my label foo blah" color.0001.tif
//hangs

Is 'rose' basically some kind of internal image to imagemagick that is part of a library or some such? If so, how do I read-in my images prior to setting the label and then combining them? I basically have a number of tif files I need to set the label for and then combine them all into a PSD, so something like this essentially:
convert foo: -set label "label A" color.0001.tif
convert foo: -set label "label B" color.0002.tif
convert foo: -set label "label C" color.0003.tif
convert color.0001.tif color.0001.tif color.0002.tif color.0003.tif foo.psd

Thanks in advance!
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: modifying layer names when writing PSD

Post by Bonzo »

Yes rose: is an image built into Imagemagick so when discussing code everybody has access to the same image.

Your foo: would need to be the tiff file e.g. input.tif
Post Reply