Page 1 of 1

Is it possible to merge multiple 'montage' command ?

Posted: 2015-04-19T02:02:18-07:00
by MrChristo
Hello everybody
I have a script that takes 4 pictures and duplicate them to have 8 small pictures in one.

Here is what i expect : http://img11.hostingpics.net/pics/831624stack.png

I have a code that works well but it needs to save multiple temporary images. So I was looking if I could merge those command to have only one image saving. That would help to make the script faster.

Code: Select all

 //Make image smaller
    convert /home/pi/images/*.png -resize 487x296 -flop  -set filename:f "/home/pi/imagesResized/%t%p" '%[filename:f].png

//Make one col off 4 images
    montage /home/pi/imagesResized/*.png -tile 1x4 -geometry +0+15 -background none  /home/pi/line.png

//Duplicate to two cols
    montage /home/pi/line.png /home/pi/line.png -tile 2x1  -geometry +45+0 -background none /home/pi/photos.png

//Add the background
    suffix=$(date +%H%M%S)
    montage /home/pi/photos.png -geometry +20+247 -texture /home/pi/data/background_photo.png /home/pi/photo_${suffix}.jpg

Is that a good way to do it ?
Thanks everybody !

Re: Is it possible to merge multiple 'montage' command ?

Posted: 2015-04-19T09:17:19-07:00
by fmw42
You did not provide your version of IM nor platform. But I assume you are on Unix. So the only way to combine these commands that I am aware is to pipe them. IM does not support combining directly between convert and montage. But you can combine successive convert commands by using parenthesis processing.

Re: Is it possible to merge multiple 'montage' command ?

Posted: 2015-04-20T00:28:15-07:00
by pipitas
MrChristo wrote:Hello everybody
I have a script that takes 4 pictures and duplicate them to have 8 small pictures in one.

Here is what i expect : http://img11.hostingpics.net/pics/831624stack.png

[....]


Is that a good way to do it ?
Thanks everybody !
You asked here too,

http://stackoverflow.com/q/29727816/359307

but so far didn't even check back for an answer! (There are 3 now, even including benchmark data...)

Re: Is it possible to merge multiple 'montage' command ?

Posted: 2015-04-20T00:33:03-07:00
by pipitas
fmw42 wrote:IM does not support combining directly between convert and montage.
This answer does so, successfully,...
...and it is getting the fastest benchmark result (a saving of ~28% in time when compared to MrChristo's 4 single commands).

But maybe with "combining" you didn't mean to include piping?

Re: Is it possible to merge multiple 'montage' command ?

Posted: 2015-04-20T09:07:44-07:00
by fmw42
This answer does so, successfully,...
It still involves piping. There is no way I know to avoid the pipe and not write temp files to disk. Perhaps some one else has a better way.