continuously merging 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
FuryKid
Posts: 3
Joined: 2016-11-09T13:03:07-07:00
Authentication code: 1151

continuously merging images

Post by FuryKid »

Hi,
I am new to ImageMagick but thought it would be a possible automated solution for the following requirements:

I have hundreds of sequentially numbered / same size pictures from timelapse shooting.
Instead of directly generating directly a movie file out of it I would like to generate transition images:

the new images (ideally) should have something like:

"last 10 images with (110 - 10*(current - position distance) opacity and next 10 images with (110 - 10*(current - position distance) opacity merged with current frame".

So there is ideally some traces in the generated stills which them alone more interesting and makes transition smoother in the movie.
This step of merging +/- 10 images has to be done for any existing picture in the sequence.

Any Idea of how to accomplish this ? If it is not possible to pass the list of images directly to ONE command, I would also appreciate any hint on whats possible or not and which parts need to be coded by myself ;-)

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

Re: continuously merging images

Post by fmw42 »

"last 10 images with (110 - 10*(current - position distance) opacity and next 10 images with (110 - 10*(current - position distance) opacity merged with current frame".
I am not sure I understand what you are asking. Can you explain a bit further. Are trying to flatten 10 images from the sequence into one image by giving each image a different opacity based upon its position in the sequence from the current image?

What is your IM version and platform? Please always provide that with questions, since syntax may differ.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: continuously merging images

Post by snibgo »

What version of IM? What platform?

Do you have enough memory to fit all the image into memory at the same time?

A possible approach: write a script that writes (and runs) a very long script. The very long script has one convert (or magick) per final frame. In that convert, it reads the 20 images, sets the alpha of each according to some formula, and combines them with "-compose Over -layers merge".

This isn't efficient, as it involves reading every input frame 20 times. If they all fit into memory, you would read them all in, write them to mpr, than pick them off 20 at a time for each output frame.
snibgo's IM pages: im.snibgo.com
FuryKid
Posts: 3
Joined: 2016-11-09T13:03:07-07:00
Authentication code: 1151

Re: continuously merging images

Post by FuryKid »

sorry forgot to mention: Platform Windows 10 / ImageMagick 7.0.3 / 32 GB Memory

@fmw42: yes - so each new image would contain 10 + 1 + 10 originals (filename of generated output image should ideally somehow be generated too)
@snibo: "efficiency" is not really necessary as this will only be done once per timelapse session, but could you please be a little bit more specific (example) as I dont even know by now how to do it for one single image ;-( and how to process imagelists.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: continuously merging images

Post by snibgo »

I don't know exactly what effect you want, but the per-frame command might be something like this. Suppose we are generating output frame 200, from input frames 190 to 210.

Code: Select all

convert ^
  ( in_200.png -channel A -evaluate set 100%% )
  ( in_201.png -channel A -evaluate set 90%% )
  ( in_199.png -channel A -evaluate set 90%% )
  ( in_202.png -channel A -evaluate set 80%% )
  ( in_198.png -channel A -evaluate set 80%% )
{and so on}
  ( in_210.png -channel A -evaluate set 10%% )
  ( in_190.png -channel A -evaluate set 10%% )
  -background None ^
  -compose Over -layers Merge ^
  out_200.png
 
I've probably got the percentages wrong.

You want one of those converts per output frame. You wouldn't write them by hand. Just do one and see if it does what you want. When you are happy, write a script that generates one of those per output frame.
snibgo's IM pages: im.snibgo.com
FuryKid
Posts: 3
Joined: 2016-11-09T13:03:07-07:00
Authentication code: 1151

Re: continuously merging images

Post by FuryKid »

ok I think I get the idea - at least of how to pass the parameters and which parts need to be generated by a wrapper script.

thx a lot !! The effect I would like to get is to have the currently fast moving clouds to leave traces / "smear across the sky"
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: continuously merging images

Post by snibgo »

Oops, I blundered. Each "-channel" should have a "+channel". like this.

Code: Select all

( in_210.png -channel A -evaluate set 10%% +channel )
snibgo's IM pages: im.snibgo.com
Post Reply