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!
modifying layer names when writing PSD
- 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
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.
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.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: modifying layer names when writing PSD
I don't use PSD, but I think it might be done with "-label".
snibgo's IM pages: im.snibgo.com
- 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
Good idea, snibgo.snibgo wrote:I don't use PSD, but I think it might be done with "-label".
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
Re: modifying layer names when writing PSD
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!
> 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!
Re: modifying layer names when writing PSD
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
Your foo: would need to be the tiff file e.g. input.tif