MNG: Status Report 19961108

Introduction

The Portable Network Graphics (PNG) [1] format for bit-mapped images was recently approved by the World Wide Web Consortium (W3C) as a W3C Recommendation. MNG is a proposed addition to the PNG family, for storing and transmitting multiple-image animations and composite frames, that is now being designed by the PNG developers.

The MNG format uses the same chunk structure (length, name, data, check value) as that used by PNG.

Because the images making up a MNG are in PNG format, MNG shares the good features of PNG:

In addition,

A Simple MNG Datastream

The simplest form of MNG is simply an 8-byte MNG file signature, a MNG header chunk (MHDR), plus a series of one or more PNG datastreams (less their 8-byte signatures), followed by a MEND chunk. MNG is more powerful than that, however. It is frequently true that the images will be similar, and data from the first image can be reused in constructing the second, to conserve on the amount of data that must be stored or transmitted. In this example, the palette and the gamma and chromaticity data are reused:
    138 M N G CR LF 26 LF       # MNG 8-byte signature
    MHDR maxwidth maxheight ... # MNG Header Chunk
    IHDR width height ...       # PNG Header Chunk
    gAMA 50000                  # PNG Gamma chunk
    cHRM ...                    # PNG Chromaticity Chunk
    PLTE ...                    # PNG Palette
    IDAT ...                    # PNG Pixel data
    IEND                        # End of first PNG datastream
    DHDR 0 1 0                  # Delta-PNG Header
    IDAT ...                    # Delta-PNG Pixels
    DEND                        # End of Delta-PNG
    MEND                        # End of MNG datastream
When only a smaller rectangle within the second image has pixels that are different from the first image, then the DHDR chunk can specify that only a smaller rectangle of pixels (sometimes called a "change box") will be transmitted. Whether the pixels for the full image or for a smaller rectangle are changed, the data can be presented as new values that replace the old ones, or as deltas (differences) from the corresponding pixels in the previous image. Usually the data in delta form is much more compressible. Several movies of finite-element calculational results by the Army Research Laboratory required only about 25 percent of the file space when converted from a simple series of PNGs to delta-encoded PNGs..

It is possible to change just the alpha samples in the image, or in selected parts of it, to fade an image in or out against a background image.

Further dramatic savings in the size of the datastream can be achieved when an image or a portion of one is merely relocated. MNG provides a LOCA chunk in which the new coordinates of the image are transmitted instead of having to retransmit the entire image. A CROP chunk is also available, to make it possible to show only a portion of a previously transmitted image, for scrolling titles or for panning across an image that is larger than the display.

Loops

MNG has a simple loop structure that can be used for repeating images. In this example, five images are defined and displayed in order 0-1-2-3-4 and then played ten times in order 3-2-1-0-1- 2-3-4:
    138 M N G CR LF 26 LF             # MNG 8-byte signature
    MHDR maxwidth maxheight ...       # MNG Header Chunk
    IHDR width height ...             # PNG Header Chunk
    gAMA ... PLTE ...   IDAT ... IEND # Define Image 0
    CLON 0 1 DHDR 1 1 1 IDAT ... IEND # Define Image 1
    CLON 1 2 DHDR 2 1 1 IDAT ... IEND # Define Image 2
    CLON 2 3 DHDR 3 1 1 IDAT ... IEND # Define Image 3
    CLON 3 4 DHDR 4 1 1 IDAT ... IEND # Define Image 4
    LOOP 0 0 10                       # Begin Loop
    SHOW 3 1 SHOW 0 4                 # Show images 3-1, 0-4
    ENDL 0                            # End Loop
    MEND                              # End MNG

Composite Frames and Sprites

In addition to the simple single-image frames described thus far, MNG also provides for composite images that are built up of two or more PNG images. For example, one image could be a full- screen background while others could be small sprites that are moved around by means of the LOCA chunk. Examples that demonstrate these capabilities and others (including scrolling, tiling, storing 3-dimensional tomographic data, and how to convert GIF animations to MNG format) are given as appendices in the MNG proposal.

MNG provides several framing modes that can be used with composite images. The modes are designed to work with "draw mode" viewers that composite the frames by drawing the images in order as they are encountered, and with "sprite mode" viewers that accumulate the images and composite them all at once, which can also allow viewers to take advantage of hardware acceleration if present. The MNG "FRAM" chunk is used to specify the framing mode. The framing modes include:

The MNG proposal explains how to render a "draw mode" frame with a "sprite mode" viewer, and vice versa.

Status of MNG

The MNG proposal is being designed by the PNG developers, and is being discussed in the "mpng-list@dworkin.wustl.edu" mailing list. Interested persons can subscribe by sending a message to
majordomo@dworkin.wustl.edu
that contains "subscribe mpng-list" (and nothing else) in the body.

The MNG format specification has not yet been frozen, but it has reached a state where test implementations are possible. There has been discussion of MNG since the completion of the PNG design in March 1995, and the first informal MNG drafts appeared on June 25, 1996. As of November 1, 1996, 22 drafts had been produced and reviewed by the PNG group.

Several prototype MNG datastreams have been written, and a viewer has been written that is able to process a subset of MNG datastreams (simple movies without composite frames), including delta-encoded images. These have already been used by the Army for real presentation work. The prototype MNG files and viewer ("viewpng", written at the U.S. Army Research Laboratory for use on IRIS workstations running IRIX 5.3), and the latest version of the MNG proposal from the PNG Development Group, are available at the MNG ftp site,

ftp://swrinde.nde.swri.edu/pub/mng/

References

1. PNG (Portable Network Graphics) Specification, Version 1.0, http://www.w3.org/pub/WWW/TR/REC-png-multi.html.

Request for Comments

Comments on the proposed MNG format are welcome, and should be addressed to mpng-list@dworkin.wustl.edu