MGHGRMOVIEFILE__DEFINE Class
MGHgrMovieFile Purpose
This class generates an animation file from a sequence of image arrays.
The MGHgrMovieFile class is modelled on the IDLgrMPEG class. It stores
images on disk in a sequence of PPM files (Put method) then combines them
into a multiple-image file (Save method) by spawning one of the following
programs:
- The ImageMagick "convert" command (http://www.imagemagick.org/)
- Klaus Ehrenfried's program "ppm2fli" for generating FLC
animations, (http://vento.pi.tu-berlin.de/fli.html).
- The Info-Zip "zip" command (http://www.cdrom.com/pub/infozip/)
The user is responsible for ensuring that the command names as
specified here invoke the command in the shell spawned by
IDL. This can be done in a variety of ways depending on the
operating system and shell.
In the current version, frames can only be added at the end of the
sequence. Properties
The following properties (ie keywords to the Init, GetProperty &
SetProperty methods) are supported
COUNT (Get)
The number of frames that have been put into the object.
DIMENSIONS (Get)
A 2-element integer array specifying the image dimensions in
pixels. This property is determined from the first frame added
to the object. It is used by the Save method when generating
FLC files, otherwise it is for information only.
FILE (Init, Get, Set)
A string specifying the name of the output file.
FORMAT (Init, Get, Set)
A string (converted internally to upper case) specifying the
output file format. See FILE FORMATS section below.
Restrictions
This class was developed and tested on a Windows XP system with
the native Win32 versions of convert, ppm2fli and zip. It should
work without modification on Unix systems.
FILE FORMATS:
With the exceptions noted below, the FORMAT property is
interpreted as an ImageMagick descriptor for a graphics-file
format supporting multiple images. Possible values include:
GIF
ImageMagick can produce multi-image GIFs. For several years,
LZW compression was missing from the binary distributions
so they produced only uncompressed GIFS. However as of
2004-04 it appears to have been reinstated.
HDF
The CONVERT documentation claims that it can write multiple
images to an HDF file, but messages on the ImageMagick
mailing list say that HDF is no longer supported.
MNG
MNG (Multiple-Image Network Graphics) is an image format based
on PNG (Portable Network Graphics) but supporting multiple
images, animation and transparent JPEGs. It's not widely
supported at the moment. See http://www.libpng.org/pub/mng/
and http://www.libpng.org/pub/png/.
PDF, PS
Images are written to a PDF or PS file, one image per page.
This could be used for printing, I guess.
TIFF
This is a handy format for holding a sequence of images with
no loss in quality, though there are no players offering
speedy playback. Compression is an issue, because the normal
LZW compression is unavailable in ImagMagick by default
(cf. GIF above). I have found Zip compression the best. It is
supported by ImageMagick and also by my preferred TIFF viewer,
Xnview (http://perso.wanadoo.fr/pierre.g/xnview/enhome.html).
The following are handled by applications other than ImageMagick:
FLC
The FLC animation format (http://crusty.er.usgs.gov/flc.html),
originally developed by Autodesk is generally less
resource-hungry than MPEG. It is limited to 256 colours, which
are assigned in an optimal way by PPM2FLI.
ZIP
If this format is selected, the PPM files are gathered into a
ZIP archive.
###########################################################################
This software is provided subject to the following conditions:
1. NIWA makes no representations or warranties regarding the
accuracy of the software, the use to which the software may
be put or the results to be obtained from the use of the
software. Accordingly NIWA accepts no liability for any loss
or damage (whether direct of indirect) incurred by any person
through the use of or reliance on the software.
2. NIWA is to be acknowledged as the original author of the
software where the software is used or presented in any form.
###########################################################################
Modification History
Mark Hadfield, 2000-02:
Written.
Mark Hadfield, 2003-10:
Updated for IDL 6.0.
Mark Hadfield, 2004-04:
Location & names of the temporary PPM files have been
changed. This has been done to make the ZIP format more usable,
as the base name for the PPM files inside the ZIP file is now
based on the output file name.
Mark Hadfield, 2006-05:
Deleted code specific to MPEG. I don't use this class to create
MPEG files any more.