Create movie that scrolls many images right to left?

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
jjbunn
Posts: 5
Joined: 2015-11-17T11:07:40-07:00
Authentication code: 1151

Create movie that scrolls many images right to left?

Post by jjbunn »

We have a set of about 200 png images that show activity on our sensor network. Each image spans one day of activity, and contains one row of pixels per sensor. Each row shows the activity on that sensor from midnight to midnight: pixels are coloured according to activity level. There are about 400 rows.

What I would like to do is make a movie that starts with the first image as the first frame, and then moves successive images in from right to left. The effect will be to look like a continuous scrolling chart of the sensor activity. I suppose it is like a frame transition effect?

I can easily make a standard mpeg movie from the images using:

Code: Select all

convert -quality 100 *.png temp.mpeg
Can I make the desired scrolling movie using ImageMagick?

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

Re: Create movie that scrolls many images right to left?

Post by fmw42 »

I am not quite clear about your situation. Your command seems to show multiple input images, but you describe a process that seems to take one image and want to convert the one image into a movie where each frame is a scrolled subsection of the original. Please explain a bit more and provide and example of your image. You can post it to some free site such as dropbox.com and put the URL here. Also what is your IM version and platform. Please always provide that with questions. See viewtopic.php?f=1&t=9620.

Edit: Also how many columns in any one of your 200 images? (How often does the sensor capture data during any 24 hours)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Create movie that scrolls many images right to left?

Post by snibgo »

I think the required task is effectively:

1. Take 200 images. Append them horizontally, making a very wide image.

2. Crop this wide image to a certain width and height, with zero offset. This will be the first frame of a movie.

3. Make another crop with a slight offset. This is the second frame.

4. Make more frames, each from increased offsets.

5. Now all the frames have been made, assemble into a movie.

Is that correct? If the inputs will fit into memory, the job is simple, probably needing just one convert command (using "-distort SRT").
snibgo's IM pages: im.snibgo.com
jjbunn
Posts: 5
Joined: 2015-11-17T11:07:40-07:00
Authentication code: 1151

Re: Create movie that scrolls many images right to left?

Post by jjbunn »

Thanks for the replies. Here is an example image:

https://dl.dropboxusercontent.com/u/133 ... 7.json.png

I am using the following ImageMagick version:

Code: Select all

Version: ImageMagick 6.9.2-6 Q16 x64 2015-11-14 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib
I think snibgo understands what the end result should look like, but I am not clear why it would be necessary to make a single large image from all the individual images, in order to create the movie. I'd imagined that a right->left transition between each frame would suffice, but perhaps not?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Create movie that scrolls many images right to left?

Post by snibgo »

I didn't say anything was necessary. I wondered if the task was effectively to append them sideways and crop from that, so you have the effect of a long continuous scroll. So each output frame might span two days of data, or even more?

How large should each frame be, in pixels? How many frames in the movie?
snibgo's IM pages: im.snibgo.com
jjbunn
Posts: 5
Joined: 2015-11-17T11:07:40-07:00
Authentication code: 1151

Re: Create movie that scrolls many images right to left?

Post by jjbunn »

snibgo wrote:I didn't say anything was necessary. I wondered if the task was effectively to append them sideways and crop from that, so you have the effect of a long continuous scroll. So each output frame might span two days of data, or even more?

How large should each frame be, in pixels? How many frames in the movie?
Thanks - Yes, the effect of a long continuous roll is exactly what I'm hoping for!

The individual images vary in vertical dimension, but they all are 1440 pixels wide. The vertical dimension varies from around 700 to around 1200 - it depends on the number of sensors: so starts at 700, and slowly increases to 1200 by the end of the image series.

I don't know how many frames should be in the movie. If the number of images is around 200 and if the pixel columns shift left at N columns/sec (I don't have a feel for a good N), the movie would last 200*1440 / N seconds. I'm thinking 60 seconds duration for the movie would be enough, but that makes N=4800, and I think N is equivalent to the frame rate?!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Create movie that scrolls many images right to left?

Post by snibgo »

Okay. 60s of video is (probably) too much to hold in memory at the same time.

Each input frame is 1440 wide, and you have around 200, so the hypothetical roll is 200*1440 = 288,000 pixels wide. If you have 60s of video, 30 fps, 1800 frames, you advance by 288,000/1800 = 160 input pixels per frame.

You need a script. For each output frame, say frame (n):

1. Calculate where in the hypothetical roll you need to crop from. x=160*n.

2. Thus, calculate what input frame(s) you need.

3. Append these frames horizontally.

4. Crop from the result.

5. Write this as out_frame_n.

And that's it.
snibgo's IM pages: im.snibgo.com
jjbunn
Posts: 5
Joined: 2015-11-17T11:07:40-07:00
Authentication code: 1151

Re: Create movie that scrolls many images right to left?

Post by jjbunn »

Ok thanks very much! I was hoping not to have to write code to do this, but I certainly can! I was looking at ffmpeg, and it looks like that could do what I need with a single (albeit complex) command.
jjbunn
Posts: 5
Joined: 2015-11-17T11:07:40-07:00
Authentication code: 1151

Re: Create movie that scrolls many images right to left?

Post by jjbunn »

I ended up using ImageMagick as well as some custom Java code to do the frame creation. Worked well!
Post Reply