Montage and save in layered 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
ntho
Posts: 2
Joined: 2017-04-04T12:14:31-07:00
Authentication code: 1151

Montage and save in layered psd

Post by ntho »

Good evening

I'm pretty new to IM. I'm trying to use montage to create a image grid from multiple images. I'd like to export this image to a layered psd so I could change and edit some things after. I was able to save it to a psd but of course its just with one layer. Would it be possible to save each added image on the montage command as a different layer in a psd?


I'm using:

Code: Select all

montage $1/*.jpg -mode concatenate -geometry +10+10 -font Helvetica $GRID droplist_$TIMESTAMP.psd
Thanks in advance! :-)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Montage and save in layered psd

Post by fmw42 »

Not directly that I know. You would need to set the -tile argument and create a series of montages adding one image each time and saving to some intermediate format. Then you would need to set the first layer as the composite layer and then write all the images to the psd to get it as layers.

Alternately, use append in a series of operations and after each append write to intermediate format such as miff that will accumulate layers. The reorder to put the composite or final layer with all the images as the first layer and the rest as other layers and save as psd.

Perhaps someone else has a better idea.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Montage and save in layered psd

Post by fmw42 »

P.S. Please always provide your IM version and platform, since syntax may differ especially if you need to script a loop.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Montage and save in layered psd

Post by fmw42 »

Do you want to show only one image per layer or all successive images in each layer? In montage, you can use null: to represent an empty image.
ntho
Posts: 2
Joined: 2017-04-04T12:14:31-07:00
Authentication code: 1151

Re: Montage and save in layered psd

Post by ntho »

fmw42 wrote: 2017-04-04T13:07:19-07:00 Do you want to show only one image per layer or all successive images in each layer? In montage, you can use null: to represent an empty image.
I'd like that each added image in montage is one layer. But I guess thats too complicated to do?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Montage and save in layered psd

Post by fmw42 »

Still not sure if you want each layer to have only one image or all successive images? And you never responded with your IM version and platform!

What is $GRID in your command?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Montage and save in layered psd

Post by fmw42 »

If you are on a Unix-like system, you can use subshell processing to save up layer in a miff: file. Then write the miff file to psd. For example, if I have 4 images (that I will create first), then I can do the following:

# create 4 different images from the rose: image

Code: Select all

convert rose: rose0.png
convert rose: -rotate 90 rose1.png
convert rose: -rotate 180 rose2.png
convert rose: -rotate 270 rose3.png
# now process the 4 images into a layered psd

Code: Select all

arr=(rose0.png rose1.png rose2.png rose3.png)
(
for ((i=0; i<4; i++)); do
convert xc:none[70x46+0+0] xc:none[70x46+0+0] xc:none[70x46+0+0] ${arr[$i]} -insert $i miff:- | montage - -background none -tile x1 -geometry +10+10 miff:-
done
) | convert - \( -clone 0-3 -background none -layers merge +repage \) +insert rose_montage.psd
http://www.fmwconcepts.com/misc_tests/rose_montage.psd

or square up the xc:none images as:

Code: Select all

convert rose: rose0.png
convert rose: -rotate 90 rose1.png
convert rose: -rotate 180 rose2.png
convert rose: -rotate 270 rose3.png
arr=(rose0.png rose1.png rose2.png rose3.png)
(
for ((i=0; i<4; i++)); do
convert xc:none[70x70+0+0] xc:none[70x70+0+0] xc:none[70x70+0+0]  ${arr[$i]} -insert $i miff:- | montage - -gravity northwest -background none -tile x1 -geometry +10+10 miff:-
done
) | convert - \( -clone 0-3 -background none -layers merge +repage \) +insert rose_montage2.psd
The parenthesis processing creates the PSD composite (first layer)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Montage and save in layered psd

Post by snibgo »

ntho wrote:I'd like that each added image in montage is one layer. But I guess thats too complicated to do?
Complication isn't the problem. "montage" makes a single raster image. You want multiple raster images. "Montage" doesn't do that.

You can, as Fred says, replicate the action of "montage" by various methods.
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: Montage and save in layered psd

Post by fmw42 »

If you cannot do the subshell processing, then you can simple composite the images in a loop into a full size background image in their proper locations writing each result to disk. Then take all the images and write them to psd.
Post Reply