I need to create a layered PSD file with ImageMagick or any other command-line tool available on Linux platform. Since I need to do this on Linux server, I can't use Photoshop scripting.
The ImageMagick command below creates PSD file with a single layer, where two images (here: plasma fractals) are positioned one below another. (I use ImageMagick 6.5.3-10 2009-07-31 Q16, latest available in MacPorts.)
convert -size 100x100 plasma:fractal plasma:fractal -append out.psd
How do I create a PSD file where each image is in its own layer, and one layer is directly above another?
Or, is there any other command line tool that would allow me to do this?
Update: Any other options than GIMP command line?
If ImageMagick won't work, I'd look at Gimp command line.
The following commands created a 2-layer PSD file for me in the interactive console:
That would need to be converted into a script-fu script (.scm file) and could be executed from the command-line with something like this:
You can use the -adjoin to combine an image sequence.
Using:
Here is some useful links to you:
The second link is to use with PHP, but it executes ImageMagick, only use the commands, not the all PHP syntax, only the line of exec code.
Hope i'm helping you!
You can create a layered PSD with ImageMagick, but note the first image is actually used as the preview image (i.e. composite of all the layers).
Will create a 2 layered PSD.
I use the command lines below. I have not encountered any issue in opening the generated PSD in Photoshop, however every layer appears as a background layer, and you have to convert it into a true layer first in order to edit the layer ordering.
Here is the command line for Window. Given the list of images (im1.xxx, im2.xxx etc, im1 being the bottom layer,) a list of labels for the layers ("label1", "label2"...) :
convert ^ ( ^ -page +0+0 ^ -label "label1" ^ im1.xxx[0] ^ -background none ^ -mosaic ^ -set colorspace RGB ^ ) ^ ( ^ -page +0+0 ^ -label "label2" ^ "im2.xxx"[0] ^ -background none ^ -mosaic ^ -set colorspace RGB ^ ) ^ ( ^ -clone 0--1 ^ -background none ^ -mosaic ^ ) ^ -alpha Off ^ -reverse ^ "out.psd"
That is, for each layer, you have something like
( ^ -page +0+0 ^ -label "optional_label" ^ im1.xxx[0] ^ -background none ^ -mosaic ^ -set colorspace RGB ^ )
The label/name of the layer is optional (remove
-label
if none.) The[0]
inim1.xxx[0]
retrieves the first image in the image file, in case there exist a thumbnail in the Exif.On Unix/OSX, you have to protect the parenthesis by a backslash, and the line continuation characters change also to
\
:\( \ -page +0+0 \ -label "optional_label" \ im1.xxx[0] \ -background none \ -mosaic \ -set colorspace RGB \ \)
If the image names contain special chars, you can protect them with
"
(eg"c:\my im1.png"
) without any issue.I agree with Jon Galloway, the Gimp console is a better choice. Here is my script:
You just need put this script into file with name "pngtopsd.scm" inside your gimp "script" directory ("c:\Program Files\GIMP 2\share\gimp\2.0\scripts\" for Windows) and you can create layered PSD from list of PNG pictures with transformation (translation or rotation) of each layer. Usage sample:
There
(list \"c:/.../2.png\" 0.7 200 1000)
means: