Skip to content

Latest commit

 

History

History
280 lines (209 loc) · 10.3 KB

Third_Edition_Explainer.md

File metadata and controls

280 lines (209 loc) · 10.3 KB

PNG Third Edition, Explained

Authors:

  • Chris Lilley

Participate

Table of Contents

Introduction

PNG is a very widely deployed, lossless, raster image format for RGB and grayscale images, with or without an alpha channel.

The First Edition was published as W3C Recommendation in 1996 and the Second Edition in 2003, also published as ISO/IEC 15948:2003.

This explainer covers solely changes for the Third Edition, currently under development. The Third Edition adds widely-requested features and folds in errata reported since the Second Edition.

Motivating Use Cases

For short animations currently better handled by Animated GIF than by video files, there is a need for an animation format which avoids the limitations of GIF (256 colors, only on-off transparency) and draws on the strengths of PNG (24 or 48bit truecolor, full alpha transparency for halo-less display over any background).

rotating GIF cube rotating APNG cube

Figure 1: Animated GIF (left) and animated truecolor PNG (right)

PNG Second Edition was limited to Standard Dynamic Range (SDR) imagery. With the growing use of High Dynamic Range (HDR) there was a need to extend PNG to support HDR images during content creation workflow for display on HDR or SDR displays.

This requirement was incubated in the Color on the Web CG.

Non-goals

Backwards compatibility with the enormous installed base of PNG images is considered paramount, so non-backwards-compatible changes such as a better compression method, are out of scope in the charter.

User research

MNG and Animated PNG

Between 1999 and 2001, a fully-featured animated format called Multiple-image Network Graphics (MNG) was developed. It could contain animations, slide shows, or complex still frames, comprised of multiple PNG (including delta images) or JNG (JPEG in a PNG-like container) single-image datastreams.

This was briefly implemented in Firefox, but was then removed in 2004 due to complexity, lack of use, and lack of maintenance for the library:

(The) mng decoder module is roughly the same size as all the other image decoders and libpr0n logic combined.

During 2004 and 2005, Vladimir Vukicevic and Stuart Parmenter (then both with Mozilla) created and refined Animated PNG (APNG), an addition to PNG (rather than an entirely separate format, like MNG) which combined the existing benefits of PNG and the limited, but demonstrably sufficient, animation features of GIF. Fallback to a non-animated PNG (which could be, but need not be, the first frame of the animation) was a feature.

Firefox 3 added APNG support in 2007.

The PNG development group, after much discussion, rejected APNG in 2007, mostly on the grounds that it was not MNG and that PNG should remain a static format. Two attempts to restart the discussion in the following years failed.

APNG was documented on the Mozilla wiki and browsers and other tools added a variety of patches to their own versions of libpng, to support APNG.

APNG started to be added to other platforms:

  • Opera 9 in 2009
  • Safari 8 in 2014
  • iOS in 2016
  • Chrome 59 in 2017
  • Edge 79 in 2019

Authoring support for APNG also improved over time.

APNG

The PNG working group was chartered in 2021 to maintain and extend the PNG specification; in particular, to add the widely adopted APNG extensions to the core PNG specification. This has now been done; specification links:

These are precisely the same as the Mozilla documentation, bringing the PNG specification into line with a decade of deployed content and implementations.

HDR support

Labelling HDR content

For SDR content, the color space is typically labelled using an ICC profile in the 'iCCP' chunk or, for sRGB content, with the 'sRGB' chunk. An ICC profile for an RGB color space typically adds 1k to 10k to the filesize, while the content of the sRGB chunk is 1 byte.

ICC profiles are rarely used to label HDR content. Instead, an ITU specification called Coding Independent Code Points (CICP) is used in HDR video workflows and also for static image formats such as AVIF or JPEG-XL.

PNG has aligned with this growing industry usage, adding the 'cICP' chunk which enables CICP labelling of the two most common HDR color spaces (BT.2100 HLG and BT.2100 PQ) with only four bytes.

As a bonus, it can also be used to compactly label some common Wide Gamut SDR color spaces, such as Display P3 and BT.2020.

Note: The third byte of 'cICP' always has the value '1', because PNG stores only RGB format images, not YCbCr or ICtCp. Explicit storage of this value was retained for compatibility with other video and image formats, and to allow for potential future expansion.

Mastering Color Volume

Video and image content is typically finalized on some reference display, called the mastering display. The content will not contain color values that cannot be reproduced on the mastering display, which sets an upper bound on the range of colors in the image.

For example, content transmitted in the BT.2100 PQ colorspace, which has a theoretical peak luminance of 10,000 cd/m², is often mastered on a display whose color primaries are similar to Display P3, with a maximum peak luminance of 2,000 cd/m² and a minimum black luminance of 0.02 cd/m.

3 gamuts

Figure 2: The color volumes of BT.2100, Display P3 and sRGB projected onto the a,b plane of the Oklab colorspace.

When displaying the content to the end user, on some other display, this mastering color volume information can be used for gamut mapping (saturation reduction of un-displayable colors) and tone mapping (compression of luminance to the darkest and brightest values supported by a display).

It is more efficient to provide this information than to expect the final display system to compute it on the fly. Especially for an image sequence, where analysis of all frames must be completed prior to displaying the first frame.

PNG stores this optional information in the same order, and using the same encoding, as SMPTE ST 2086, a standard which is widely used in the streaming, broadcast and TV industries. This is expected to ease deployment by fitting smoothly into existing industry workflows.

The content of the 'mDCv' chunk is only 24 bytes.

Specification link:

Content Luminance Levels

Tone mapping of an HDR image or animation onto some end-user display is made easier by knowing the luminance levels in the actual image data.

Two items are of interest; firstly the average luminance level of the brightest frame, and secondly the luminance of the brightest pixel.

The industry standard terms for these are MaxFALL (Maximum Frame Average Light Level) and MaxCLL (Maximum Content Light Level), and these are required metatada for HDR10 content.

As with 'mDCv', it is more efficient to provide this information than to expect the final display system to compute it on the fly. Especially for an image sequence, where analysis of all frames must be completed prior to displaying the first frame.

The content of the 'cLLI' chunk is only 8 bytes.

Specification link:

Stakeholder Feedback / Opposition

  • [Mozilla] : Positive, implements APNG
  • [Chromium] : Positive, implements APNG and CICP
  • [WebKit] : Positive, implements APNG
  • [HDR content creators] : Positive, re-use of existing workflows

References

[APNG] APNG Specification version 1.0. Mozilla Wiki. URL: https://wiki.mozilla.org/APNG_Specification

[HDR10] Best Practices: How to Calculate HDR10 Metadata (MaxFALL, MaxCLL) Dolby Vision Post Production knowledge base. Dolby, 2020-10. URL: https://professionalsupport.dolby.com/s/article/Calculation-of-MaxFALL-and-MaxCLL-metadata?language=en_US

[ITU-R BT.2100] ITU-R BT.2100, SERIES BT: BROADCASTING SERVICE (TELEVISION). Image parameter values for high dynamic range television for use in production and international programme exchange. ITU. 2018-07. URL: https://www.itu.int/rec/R-REC-BT.2100

[PNG-HDR] Adding support for HDR imagery to the PNG format W3C Color on the Web CG. URL: https://github.com/w3c/ColorWeb-CG/blob/main/hdr-in-png-requirements.md

[SMPTE ST 2086] Mastering Display Color Volume Metadata Supporting High Luminance and Wide Color Gamut Images. Society of Motion Picture and Television Engineers. 27 April 2018. URL: https://ieeexplore.ieee.org/document/8353899