How to generate transition images between to images?

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
hedinn

How to generate transition images between to images?

Post by hedinn »

Hi.

I have a problem that I suspect IM could solve for me. I gues it woud require some scripting and I havn't a clue of where to begin. So I turn to you...

Only the first part I describe under, I don't know how to do, but I'll just include my whole intention with my images to give you the full picture of what I intend to do with them.

Problem:
I have several series of images of aurora borealis, and each series contains about 1600 hi-resolution images. This is from an exposure every 6 seconds thruout one whole night.

I plan to make a time laps movie of them, and I need to generate a fadeing transition between every image by generate several transition images between them.
There is not that much difference between six seconds on the nigt sky - even with aurora, and through small scale testing, I've found that a transition of 10 images is sufficient to get a nice "continious" feeleng on the video. But to generate this manually 1600 times just isn't an option. (and these numbers are just for one of my many image series)

I need a more smooth way of generating these nearly 15000 images. One suggestion is some clever imagemagick scripting. I love imagemagick - used it for years, but I'm not particulary good with scripting.

If anyone have some suggestions on this, I would be extremely grateful!!

The rest:
Later I will stitch these approx. 16000 images together to a hi-res. time laps vidio. This I know how to do.
The 16000 images correspond to one image every 0.6 second. If I use a framerate of 25, this would give smooth timelaps video of approx 10.5 min of the whole aurora night.

I could of cource buy photoshop and do this on a windows computer at work. A friend of mine says it's possible with som clever photoshop automation scripting. But my collegues continiously nags me (friendly of cource) for choosing linux on my private and work computers, so I refuse to do so out of mere principle :)

Hope some more skilled user could point me in the right direction. In advance thanks.

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

Re: How to generate transition images between to images?

Post by fmw42 »

hedinn

Re: How to generate transition images between to images?

Post by hedinn »

Hello again.

Tanks for quick answer, but I guess this still doesn't solve my problem.

As far as I understand from the documentation, -morph require the output to be one single file supporting multiple frames, such as gif. I need the output to be one file for each frame/image. My images are more than 3000x3000 px and i don't see any single multi-frame image containing the total of 16.000 of them (about 40 gb).

Is there any way of getting the -morph operator to save all the generated frames as single images, preferable with some sort of increasing numbering?

Regards

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

Re: How to generate transition images between to images?

Post by fmw42 »

morph uses 2 or more input images and adds frames between them per the parameter

with png or jpg, you get multiple output images with -0, -1, ... appended as they do not support multipframe images

convert zelda3.png lena2.png -delay 20 -morph 10 tmp_zl.png

identify tmp_zl-*.png
tmp_zl-0.png PNG 128x128 128x128+0+0 16-bit DirectClass 54.8KB 0.000u 0:00.000
tmp_zl-1.png[1] PNG 128x128 128x128+0+0 16-bit DirectClass 89.4KB 0.000u 0:00.000
tmp_zl-10.png[2] PNG 128x128 128x128+0+0 16-bit DirectClass 86.5KB 0.000u 0:00.000
tmp_zl-11.png[3] PNG 128x128 128x128+0+0 8-bit DirectClass 31.2KB 0.000u 0:00.000
tmp_zl-2.png[4] PNG 128x128 128x128+0+0 16-bit DirectClass 89.2KB 0.000u 0:00.000
tmp_zl-3.png[5] PNG 128x128 128x128+0+0 16-bit DirectClass 89.3KB 0.000u 0:00.000
tmp_zl-4.png[6] PNG 128x128 128x128+0+0 16-bit DirectClass 89KB 0.010u 0:00.000
tmp_zl-5.png[7] PNG 128x128 128x128+0+0 16-bit DirectClass 88.7KB 0.000u 0:00.000
tmp_zl-6.png[8] PNG 128x128 128x128+0+0 16-bit DirectClass 88.4KB 0.000u 0:00.000
tmp_zl-7.png[9] PNG 128x128 128x128+0+0 16-bit DirectClass 87.9KB 0.000u 0:00.000
tmp_zl-8.png[10] PNG 128x128 128x128+0+0 16-bit DirectClass 87.6KB 0.000u 0:00.000
tmp_zl-9.png[11] PNG 128x128 128x128+0+0 16-bit DirectClass 87KB 0.000u 0:00.000

or use gif or tiff to get multiframe images (all in the one image)

convert zelda3.png lena2.png -delay 20 -morph 10 tmp_zl.gif
identify tmp_zl.gif
tmp_zl.gif[0] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 191KB 0.000u 0:00.000
tmp_zl.gif[1] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 191KB 0.000u 0:00.009
tmp_zl.gif[2] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 191KB 0.000u 0:00.009
tmp_zl.gif[3] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 191KB 0.000u 0:00.009
tmp_zl.gif[4] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 191KB 0.000u 0:00.009
tmp_zl.gif[5] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 191KB 0.000u 0:00.009
tmp_zl.gif[6] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 191KB 0.000u 0:00.009
tmp_zl.gif[7] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 191KB 0.000u 0:00.009
tmp_zl.gif[8] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 191KB 0.000u 0:00.009
tmp_zl.gif[9] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 191KB 0.000u 0:00.009
tmp_zl.gif[10] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 191KB 0.000u 0:00.009
tmp_zl.gif[11] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 191KB 0.000u 0:00.009

or by adding +adjoin, you can force the gif or tiff to behave like jpg or png


Here is 3 input images with 5 frames morphed between them


convert zelda3.png lena2.png zelda3g.png -delay 20 -morph 5 tmp_zlz.gif
identify tmp_zlz.gif
tmp_zlz.gif[0] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 203KB 0.000u 0:00.009
tmp_zlz.gif[1] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 203KB 0.000u 0:00.009
tmp_zlz.gif[2] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 203KB 0.000u 0:00.009
tmp_zlz.gif[3] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 203KB 0.000u 0:00.009
tmp_zlz.gif[4] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 203KB 0.000u 0:00.009
tmp_zlz.gif[5] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 203KB 0.000u 0:00.009
tmp_zlz.gif[6] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 203KB 0.000u 0:00.009
tmp_zlz.gif[7] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 203KB 0.000u 0:00.000
tmp_zlz.gif[8] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 203KB 0.000u 0:00.000
tmp_zlz.gif[9] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 203KB 0.000u 0:00.000
tmp_zlz.gif[10] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 203KB 0.000u 0:00.000
tmp_zlz.gif[11] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 203KB 0.000u 0:00.000
tmp_zlz.gif[12] GIF 128x128 128x128+0+0 8-bit PseudoClass 256c 203KB 0.000u 0:00.000
hedinn

Re: How to generate transition images between to images?

Post by hedinn »

PERFECT!!! Problem solved.

The line I've been looking for.. This will make my aurora film in a "swish" :)

Thank you!

Regards

Hedinn
hedinn

Re: How to generate transition images between to images?

Post by hedinn »

Oops - I was a little hasty there...

I used the line
convert original/*.jpg -delay 20 -morph 10 new/img%03d.jpg
First I tried it on some small-scale images I have for testing (320x320), and it worked quite nice. But then I tried it on my original high-res files, and it seems that it can manage only 3 or less images in the directory. Trying it on a directory containing 4 or more images, the program hangs indefinitely.

Am I using the command wrong, or forgetting something?

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

Re: How to generate transition images between to images?

Post by fmw42 »

Probably running out of memory. See memory management for large image processing at

http://www.imagemagick.org/Usage/files/#massive
Post Reply