comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » making movies in idl
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
making movies in idl [message #10249] Wed, 05 November 1997 00:00 Go to next message
nospam is currently offline  nospam
Messages: 21
Registered: November 1997
Junior Member
I have a set of IDL generated images that show how a two-dimensional
system changes as a parameter is varied, and I want to make an
animation that can go on a web page. How would I go about doing that
in IDL? A mult-image gif file would probably work nicely, but IDL's
write_gif routine only makes single image files.

Thanks for you feedback!

scott

--
Scott Stuart
stuart at ll mit edu
Re: making movies in idl [message #10299 is a reply to message #10249] Mon, 10 November 1997 00:00 Go to previous messageGo to next message
Ian Sprod is currently offline  Ian Sprod
Messages: 5
Registered: November 1997
Junior Member
Joseph

The new version of write_gif in IDL5 does allow the cration of GIF89a's
with multiple images per file.

For MPEGs and the like, I usually use one of the "standard" MPEG
creation
C routines (there are several on the net for unix) and use a shell
script
to send in the filenames of my IDL generated GIFs (or whatever).

I seem to remember someone posted a nice IDL "wrapper" script a while
back to do all this for you, but I never saved it :-(

I suggested to RSI they might want to add a save-as-movie-file feature
to IDL but is ain't there yet (except for the GIFs).

Good luck!

Ian

>
> I have a set of IDL generated images that show how a two-dimensional
> system changes as a parameter is varied, and I want to make an
> animation that can go on a web page. How would I go about doing that
> in IDL? A mult-image gif file would probably work nicely, but IDL's
> write_gif routine only makes single image files.
>
> Thanks for you feedback!
>
> scott
>
> --
> Scott Stuart
> stuart at ll mit edu

--

Ian E. Sprod
CIRES ian@ngdc.noaa.gov
NOAA/NGDC E/GC1 http://swat.ngdc.noaa.gov/~ian
325 Broadway 303-497-6284 (voice)
Boulder, CO 80303 303-497-6513 (fax)
Re: making movies in idl [message #10312 is a reply to message #10249] Fri, 07 November 1997 00:00 Go to previous messageGo to next message
David Foster is currently offline  David Foster
Messages: 341
Registered: January 1996
Senior Member
Joseph Scott Stuart wrote:
>
> I have a set of IDL generated images that show how a two-dimensional
> system changes as a parameter is varied, and I want to make an
> animation that can go on a web page. How would I go about doing that
> in IDL? A mult-image gif file would probably work nicely, but IDL's
> write_gif routine only makes single image files.
>
> Thanks for you feedback!
>
> scott

Scott:

You can use a WRITE_MPEG routine that I got off this newsgroup
some time ago. You will also need the UNIX utility 'mpeg_encode'
(web site included below):

---------- Cut HERE ------------------------------------------------
; Subject: Re: MPEG creation with IDL
; From: scott@abyss.ATMOS.ColoState.Edu (Scott Denning)
;
; The following idl procedure will produce an mpeg file from a series of
; images stored in a 3D array (width x height x # of frames). It
requires
; the "mpeg_encode" executable to be in the unix search path. This can
be
; obtained from ftp://mm-ftp.cs.berkeley.edu/pub/ .
;
; Multimedia stuff previously at:
; ftp://s2k-ftp.cs.berkeley.edu/pub/multimedia/mpeg/encode.
;
; There are lots of options that can be handled differently, to make
; tradeoffs between image quality, speed, and disk space. See the
; documentation for mpeg_encode for more details.
;
; If your animation is stored in the array "image_array" and you want to
; write it to a file called "movie.mpg," you would do so by typing
;
; WRITE_MPEG, 'movie.mpg', image_array
;


PRO WRITE_MPEG, mpegFileName, image_array

movieSize = SIZE(image_array)
xSize = movieSize(1)
ySize = movieSize(2)
nFrames = movieSize(3)

nDigits = 1+FIX(ALOG10(nFrames))
formatString = STRCOMPRESS('(i'+STRING(nDigits)+'.'+STRING(nDigits)$
+ ')', /REMOVE_ALL)
; Load current color table into byte arrays
TVLCT, red, green, blue, /GET
red = BYTE(red)
green = BYTE(green)
blue = BYTE(blue)

ON_IOERROR, badWrite

; Make a temporary directory if necessary or clear it otherwise'
TMPDIR = '/tmp/idl2mpeg.frames'
SPAWN, 'if (-d ' + TMPDIR + ') echo "exists"', result
dirExists = result(0) EQ 'exists'
IF dirExists THEN command = 'rm ' + TMPDIR + '/*' $
ELSE command = 'mkdir ' + TMPDIR
SPAWN, command

; Write each frame into TMPDIR as an 8-bit .gif image file
FOR frameNum = 0, nFrames-1 DO BEGIN
fileName = TMPDIR + '/frame.' + STRING(frameNum,FORMAT=formatString)$
+ '.gif'
WRITE_GIF, fileName, image_array(*,*,frameNum), red, green, blue
ENDFOR
; Build the mpeg parameter file
paramFile = TMPDIR + '/idl2mpeg.params'
OPENW, unit, paramFile, /GET_LUN
PRINTF, unit, 'PATTERN IBBBBBBBBBBP'
PRINTF, unit, 'OUTPUT ' + mpegFileName
PRINTF, unit, 'GOP_SIZE 12'
PRINTF, unit, 'SLICES_PER_FRAME 5'
PRINTF, unit, 'BASE_FILE_FORMAT PPM'
PRINTF, unit, 'INPUT_CONVERT giftoppm *'
PRINTF, unit, 'INPUT_DIR /tmp/idl2mpeg.frames'
PRINTF, unit, 'INPUT'
PRINTF, unit, '`ls *.gif`'
PRINTF, unit, 'END_INPUT'
PRINTF, unit, 'PIXEL FULL'
PRINTF, unit, 'RANGE 5'
PRINTF, unit, 'PSEARCH_ALG LOGARITHMIC'
PRINTF, unit, 'BSEARCH_ALG SIMPLE'
PRINTF, unit, 'IQSCALE 8'
PRINTF, unit, 'PQSCALE 8'
PRINTF, unit, 'BQSCALE 8'
PRINTF, unit, 'REFERENCE_FRAME DECODED'
PRINTF, unit, 'FORCE_ENCODE_LAST_FRAME'
FREE_LUN, unit

; spawn a shell to process the mpeg_encode command
SPAWN, 'mpeg_encode ' + paramFile

RETURN

badWrite:
alert, 'Unable to write MPEG file!'

END
------------- Cut HERE -----------------------------------------------

Dave
--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2240
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
Re: making movies in idl [message #10318 is a reply to message #10249] Thu, 06 November 1997 00:00 Go to previous messageGo to next message
Andy Loughe is currently offline  Andy Loughe
Messages: 174
Registered: November 1995
Senior Member
Joseph Scott Stuart wrote:
>
> I have a set of IDL generated images that show how a two-dimensional
> system changes as a parameter is varied, and I want to make an
> animation that can go on a web page. How would I go about doing that
> in IDL? A mult-image gif file would probably work nicely, but IDL's
> write_gif routine only makes single image files.


I use write_gif, then a unix utility called gifmerge.

Try this web site...

http://www.iis.ee.ethz.ch/~kiwi/GIFMerge/

--
Andrew F. Loughe |
afl@cdc.noaa.gov
University of Colorado, CIRES Box 449 |
http://cdc.noaa.gov/~afl
Boulder, CO 80309-0449 | phn:(303)492-0707
fax:(303)497-7013
------------------------------------------------------------ ---------------
"I do not feel obliged to believe that the same God who has endowed us
with
sense, reason, and intellect has intended us to forego their use."
-Galileo
Re: Making movies [message #51407 is a reply to message #10249] Mon, 20 November 2006 11:33 Go to previous messageGo to next message
Carsten Lechte is currently offline  Carsten Lechte
Messages: 124
Registered: August 2006
Senior Member
Hi,

this is not Mac specific, but uses ImageMagick:

convert -adjoin -delay 10 lots_of_plots*.eps result_anim.gif


The point I would like to make is that it may be worthwhile
to use EPS files as the basis for the movie. I needed nice-looking
EPS versions of some of the plots for my paper anyway, and I did not
want to have to tweak my plotting routines for two kinds of output
format. EPS seemed the most versatile. Of course, this costs another
conversion step in the movie generation.


chl
Re: Making movies [message #51409 is a reply to message #10249] Mon, 20 November 2006 09:25 Go to previous messageGo to next message
Brian Larsen is currently offline  Brian Larsen
Messages: 270
Registered: June 2006
Senior Member
I have always used quicktime pro with fantastic results and its $30
which is well worth it. I have also used imagemagick and it works but
does not do as well.

Cheers,

Brian
Re: Making movies [message #51410 is a reply to message #10249] Mon, 20 November 2006 09:06 Go to previous messageGo to next message
Jeff Hester is currently offline  Jeff Hester
Messages: 21
Registered: December 2001
Junior Member
Kenneth Bowman wrote:

> In article <k-bowman-2F4109.22074918112006@news-new.tamu.edu>,
> "Kenneth P. Bowman" <k-bowman@removethis.tamu.edu> wrote:
>
>
>> First, in IDL, write all the frames into a directory in some
>> obvious sequence like
>>
>> WRITE_PNG, 'frame_' + STRING(i, FORMAT = "(I4.4)") + '.png'
>
>
> I realized this morning that I forgot to include the image in the
> above IDL command (duh), which should look like this:
>
> WRITE_PNG, 'frame_' + STRING(i, FORMAT = "(I4.4)") + '.png', TVRD(TRUE = 1)
>
> I put an expanded version of my earlier message online at
>
> http://idl.tamu.edu/mactips/movies.php
>
> Cheers, Ken
Hi Ken,

Writing the images from IDL I can handle. The problem was selecting a
Mac tool to take the PNG files and string them together into a movie.
Thanks for the pointer to GraphicConverter. I'll give it a try.

Cheers,
Jeff
Re: Making movies [message #51417 is a reply to message #10249] Mon, 20 November 2006 06:39 Go to previous messageGo to next message
K. Bowman is currently offline  K. Bowman
Messages: 330
Registered: May 2000
Senior Member
In article <k-bowman-2F4109.22074918112006@news-new.tamu.edu>,
"Kenneth P. Bowman" <k-bowman@removethis.tamu.edu> wrote:

> First, in IDL, write all the frames into a directory in some
> obvious sequence like
>
> WRITE_PNG, 'frame_' + STRING(i, FORMAT = "(I4.4)") + '.png'

I realized this morning that I forgot to include the image in the
above IDL command (duh), which should look like this:

WRITE_PNG, 'frame_' + STRING(i, FORMAT = "(I4.4)") + '.png', TVRD(TRUE = 1)

I put an expanded version of my earlier message online at

http://idl.tamu.edu/mactips/movies.php

Cheers, Ken
Re: Making movies [message #51427 is a reply to message #10249] Sat, 18 November 2006 20:07 Go to previous messageGo to next message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article <q6O7h.6144$7G4.5036@newsfe22.lga>,
Jeff Hester <jhester@asu.edu> wrote:

> Does anyone have a preferred solution on a Mac for stringing a bunch of
> frames together to make a movie? I've never really liked the MPEG
> routines in IDL for a variety of reasons (everything from quality of
> output to inconsistencies in the movie headers that can cause them to
> play incorrectly when launched from PowerPoint). Macs are supposed to
> be god's gift to movies, so I am certain that there are 10^4 ways of
> making a movie out of a few hundred TIFF files, but I'd settle for one
> that will make a high quality output with a sensible codec and variable
> frame rate.
>
> Thanks,
> Jeff

I'll try to get around to adding this to the MacTips web page.

http://idl.tamu.edu/mactips.php

Here is the short version.

I don't currently have a good programmatic solution from inside IDL, but
there are at least two easy ways to do it using external apps.

First, in IDL, write all the frames into a directory in some
obvious sequence like

WRITE_PNG, 'frame_' + STRING(i, FORMAT = "(I4.4)") + '.png'

I much prefer PNGs to TIFFs (8- and 24-bit, good lossless compression,
no MPEG artifacts, public domain, ...)

Once the frames are created, use GraphicConverter or QuickTime Pro to
make the frames into a movie.

GraphicConverter is an outstanding shareware program that will convert
between virtually any two graphic formats. Choose Convert & Modify from
the File menu. On the left, navigate to the directory containing the frames.
Select all the frames that you want in the movie. On the right, avigate to
the directory where you want the movie to go. Set the Dest. Format to
QuickTime (.mov). Click the Options button and select the PNG compressor.
Set the frame rate. Turn off Key frames. Click OK to get back to the
Convert & Modify dialog. Click Go. You may need to wait after if finishes
reading the files for the QuickTime movie to be created (depends on number
and size of frames).

Last, pay the shareware fee for GraphicConverter. :-)

You can also do this with Apple's QuickTime, but you have to pay Apple
the $20 or whatever to "upgrade" QuickTime to QuickTime Pro.

Ken Bowman
Re: Making movies [message #51511 is a reply to message #51409] Thu, 23 November 2006 10:52 Go to previous message
Jeff Hester is currently offline  Jeff Hester
Messages: 21
Registered: December 2001
Junior Member
Brian Larsen wrote:
> I have always used quicktime pro with fantastic results and its $30
> which is well worth it. I have also used imagemagick and it works but
> does not do as well.
>
> Cheers,
>
> Brian
>

I may break down and pay Apple the $30. My experience with making
movies with imagemagick mirrors your own. Thanks for the numerous
suggestions.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: moving average of a large array
Next Topic: Natural Neighbor Interpolation

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:43:21 PDT 2025

Total time taken to generate the page: 0.00529 seconds