How to put several images on a frame when using "-dispose" ?

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
binocthex11

How to put several images on a frame when using "-dispose" ?

Post by binocthex11 »

For example, using this command:

Code: Select all

convert \
    -delay 1x2 -dispose none -size 640x360 \
        xc:SkyBlue +antialias \
        -fill DodgerBlue -draw 'circle 50,50 15,25' \
    -dispose previous \
        -page +0+0   	one.bmp \
        -page +300+300 two.bmp \
        -page +50+50 	three.bmp \
	-page +60+60 	four.bmp \
    -loop 0 \
    result.gif
I can make a simple animation, which displays the four BMP files one by one.
Here is the question, what command should I use to display two or more images simultaneously on a single frame?
That is to say, I want to let the animation show one.bmp and two.bmp together, then three.bmp and four.bmp on the next frame.


Thanks a lot!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to put several images on a frame when using "-dispos

Post by fmw42 »

You probably need to append the images before writing to each frame. see -append or +append http://www.imagemagick.org/script/comma ... php#append and http://www.imagemagick.org/Usage/layers/#append
if you want them side-by-side in a row or column.

If you want them in a grid, see montage at http://www.imagemagick.org/Usage/montage/
binocthex11

Re: How to put several images on a frame when using "-dispos

Post by binocthex11 »

fmw42 wrote:You probably need to append the images before writing to each frame. see -append or +append http://www.imagemagick.org/script/comma ... php#append and http://www.imagemagick.org/Usage/layers/#append
if you want them side-by-side in a row or column.

If you want them in a grid, see montage at http://www.imagemagick.org/Usage/montage/

Well, actually I want them to be at any position I wish. I'm trying '-composite' but this piece of code does not work, error message is given:

Code: Select all

$ convert -size 640x360 \
>   one.bmp -geometry +0+0 -composite \
>   two.bmp -geometry +300+300 -composite \
>   result.gif
convert.exe: missing an image filename `result.gif'.
binocthex11

Re: How to put several images on a frame when using "-dispos

Post by binocthex11 »

binocthex11 wrote:
fmw42 wrote:You probably need to append the images before writing to each frame. see -append or +append http://www.imagemagick.org/script/comma ... php#append and http://www.imagemagick.org/Usage/layers/#append
if you want them side-by-side in a row or column.

If you want them in a grid, see montage at http://www.imagemagick.org/Usage/montage/

Well, actually I want them to be at any position I wish. I'm trying '-composite' but this piece of code does not work, error message is given:

Code: Select all

$ convert -size 640x360 \
>   one.bmp -geometry +0+0 -composite \
>   two.bmp -geometry +300+300 -composite \
>   result.gif
convert.exe: missing an image filename `result.gif'.

I made a mistake. It does work.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to put several images on a frame when using "-dispos

Post by fmw42 »

convert -size 640x360 \
one.bmp -geometry +0+0 -composite \
two.bmp -geometry +300+300 -composite \
result.gif
convert.exe: missing an image filename `result.gif'.
You should define an image with some color for the background, here I use white

convert -size 640x360 xc:white \
one.bmp -geometry +0+0 -composite \
two.bmp -geometry +300+300 -composite \
result.gif

You can also do it with one operation using -flatten for example (with -page rather than -geometry). see http://www.imagemagick.org/Usage/layers/#flatten
Post Reply