MNG and JNG: Status Report 20010112 MNG: A Multiple-Image Format in the PNG Family and JNG: JPEG Network Graphics Format On January 11, 2001, the PNG Development Group approved the MNG-1.0 (Multiple-image Network Graphics) [1]. and JNG-1.0 (JPEG Network Graphics) [2]. specifications. (The documents are presently at version 0.997; version 1.0 documents will be released shortly.) MNG and JNG are additions to the PNG family. MNG is for storing and transmitting multiple-image animations and composite frames, and JNG is a MNG sub-format for encapsulating JPEG images, with alpha-channel transparency, in a format usable by MNG. The Portable Network Graphics (PNG) [3] format for bit-mapped images was approved in October 1996 by the World Wide Web Consortium (W3C) as a W3C Recommendation and has also been published as RFC-2083 [4]. The PNG group has since released Version 1.2 [5], which has not yet been approved by any standards body, but it is being considered for ISO standardization. Because the images making up a MNG are in PNG and JNG format, MNG shares the good features of PNG: * It is unencumbered by patents. * It is streamable. * It has excellent, lossless compression. * It stores up to 16 bits per channel. * It provides transparency and an alpha channel, in both PNG and JNG formats. * It provides platform-independent rendition of colors by inclusion of gamma and chromaticity information. * It provides early detection of common file transmission errors and robust detection of file corruption. * Single-image GIF ("Graphical Interchange Format") files can be losslessly converted to PNG. In addition, * It provides animation with loops and variable interframe delays. * It allows composition of frames containing multiple images. * It facilitates the use of images as "sprites." * It capitalizes on frame-to-frame similarities to reduce the amount of data that must be included in the datastream. * Using JNG together with a magnification factor, it can achieve 1000:1 and higher lossy compression of Megapixel truecolor images. While some detail is lost, such highly-compressed images are useful as full-scale previews and for layout work. * It provides "restart" points at which an animation can be resumed in case of data loss or corruption. * A "frame priority" chunk allows authors to indicate which frame should be displayed by single-image viewers, and a subset of the frames that should be displayed by slow viewers. * Multiple-image GIF files can be losslessly converted to MNG. * It includes a lossy sub-format that provides JPEG with alpha. * It is complementary to MPEG and does not attempt to replace MPEG for lossy storage of video (however, MNG does include the lossy JNG format). A Simple MNG Datastream The MNG format uses the same chunk structure (length, name, data, check value) as that used by PNG. The simplest form of MNG is an 8-byte MNG file signature, a MNG header chunk (MHDR), plus a series of one or more PNG or JNG 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 from the first image are reused in the second image: 138 M N G CR LF 26 LF # MNG 8-byte signature MHDR maxwidth maxheight ... # MNG Header chunk DEFI 1 visible concrete # MNG Define image 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 1 png replace width ht # 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 those in the first image, 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 U. S. Army Research Laboratory required only about a quarter 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 or just the color 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 MOVE chunk in which the new coordinates of the image are transmitted instead of having to retransmit the entire image. A CLIP chunk is also available, to make it possible to show only a portion of a previously transmitted image. The MOVE and CLIP chunks can be used for scrolling or panning across an image that is larger than the display area. 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 1-2-3-4-5 and then played ten times in order 4-3-2-1- 2-3-4-5: 138 M N G CR LF 26 LF # MNG 8-byte signature MHDR maxwidth maxheight ... # MNG Header Chunk IHDR width height ... # PNG Header Chunk DHDR 1 ... PLTE ... 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 CLON 4 5 DHDR 5 1 1 IDAT ... IEND # Define Image 5 LOOP 0 10 # Begin Loop SHOW 4 2 SHOW 1 5 # Show images 4-2, 1-5 ENDL 0 # End Loop MEND # End MNG Composite Frames and Sprites In addition to the simple single-image frames described thus far, MNG can also describe 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 MOVE chunk. Examples that demonstrate these capabilities and others (including scrolling, tiling, storing 3-D tomographic data, and converting GIF animations to MNG format) are given as appendices in the MNG proposal. MNG provides four framing modes that can be used with composite images. The framing modes include: * Not restoring the background between frames o Each image is a separate frame, as in the two examples shown previously (mode 1). o A group of images makes up a frame (mode 2). * Restoring the background between frames o Each image is a separate frame (mode 3). o A group of images makes up a frame (mode 4). Status of MNG The MNG specification was designed by the PNG developers and is being discussed in the "mng-list@ccrc.wustl.edu" mailing list. Interested persons can subscribe by sending a message to majordomo@ccrc.wustl.edu that contains the line "subscribe mng-list" (and nothing else) in the body. There has been discussion of MNG since the completion of the PNG design in March 1995, and the first informal MNG draft appeared on June 25, 1996. As of January 10, 2001, 88 drafts had been produced for review by the PNG group. The major changes since Draft 33 (issued in late January, 1997) have been the addition of several fields to the MHDR chunk, revision of framing modes, addition of the JNG format, improvement of palette animation via a new PPLT chunk, addition of the global PLTE and tRNS chunks, making the SAVE/SEEK chunks ignorable by simple decoders, minor redesign of the LOOP chunk, and recent addition of the MAGN and JDAA chunks. The examples shown above are consistent with Draft 33, except for the reordering of the LOOP chunk fields. Draft 55 was designated MNG-0.9, signifying a move from "alpha" to "beta" status and an intention to "freeze" or at least "gel" the design. On May 11, 1999, the PNG group voted to approve version MNG-0.95 and agreed that any subsequent technical changes to the specification would require a vote. Several minor changes were approved in May and July 1999, and these were incorporated in the MNG-0.96 release. There was another spurt of development activity during the fall of 2000, based on experience with beta implementations, and the changes were incorporated in the MNG-0.98, MNG-0.99, and MNG-0.995 and MNG-0.997 releases. MNG-0.995 was the document voted on in January 2001 for elevation to MNG-1.0 status, and MNG-0.997 reflects only editorial changes. In addition to MNG itself, two subset formats have also been defined, namely MNG-LC (Low Complexity) and MNG-VLC (Very Low Complexity). These are proper subsets of MNG without the reusable-object, Delta-PNG, and LOOP capability, which can be used for simple animations, storage of multiple-page fax documents, and the like. A supporting library for MNG is being developed by Gerard Juyn. It is freeware, available at . A number of prototype MNG datastreams have been written, and several viewers have been written that are able to process a subset of MNG datastreams (simple movies and composite frames), including delta-encoded images. One was used by the U. S. Army for real presentation work as early as September 1996. The prototype MNG files and a testbed viewer ("ARL viewpng", written at the U.S. Army Research Laboratory for use on SGI 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, "ARL viewpng" is no longer being updated, having served its purpose as a testbed for demonstrating the MNG concept. A more complete viewer, "MNGeye" for Windows-95 and Windows NT, by Gerard Juyn, was released on August 1, 1998. It is available at ImageMagick and Paint Shop Pro are supporting subsets of MNG. The ImageMagick subset includes a complete implementation of MNG-LC, and the source code is freely available at . ImageMagick has been shown to be able to convert typical animated banners found on the Internet from GIF to MNG with about a 10 percent reduction in file size. Mozilla and Netscape 6 are supporting MNG via libmng. JNG JNG (JPEG Network Graphics) [2] is a subformat that was designed in June 1998 for use with MNG. It consists of a JPEG datastream wrapped in PNG-style chunks along with an alpha channel that is encoded in PNG IDAT format. The alpha channel can also be encoded as a grayscale JPEG and wrapped in JDAA chunks. This offers JPEG with transparency that can be used as a standalone image or as an image within a MNG datastream. Competing proposals Two competing proposals have also been written, both around January 1997, and have been dormant since then. The drafts for these proposals can be found in the "documents/history" subdirectory at the MNG ftp site mentioned above. They are * "ARG: Animated Raster Graphics". * "DOH: Dancing Optical Hallucinations". A number of the ideas in DOH were incorported in MNG. References 1.Randers-Pehrson, G., et. al., MNG (Multiple-image Network Graphics) Format, Version 0.997, . 2.Randers-Pehrson, G., et. al., JNG (JPEG Network Graphics) Format, Version 0.997, . 3.Boutell, T., et. al., PNG (Portable Network Graphics) Specification, Version 1.0, . 4. Boutell, T., et. al., PNG (Portable Network Graphics) Specification, Version 1.0, RFC 2083, 5. Randers-Pehrson, G., et. al., PNG (Portable Network Graphics) Specification, Version 1.2, Trademarks * GIF is a service mark of CompuServe Incorporated. * Netscape is a trademark of Netscape Communications, Inc. * SGI and IRIX are trademarks of Silicon Graphics, Inc. * Windows-95 and Windows NT are trademarks of MicroSoft, Inc. Author Glenn Randers-Pehrson 611 Rivershore Court Edgewood, Maryland 21040 This is a revised version of an article that appeared in the Winter 1997 issue of the World Wide Web Journal Request for Comments Comments on the MNG and JNG formats are welcome and should be addressed to mng-list@ccrc.wustl.edu