⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rfc2083.txt

📁 RFC 的详细文档!
💻 TXT
📖 第 1 页 / 共 5 页
字号:






Network Working Group                                T. Boutell, et. al.
Request for Comments: 2083                             Boutell.Com, Inc.
Category: Informational                                       March 1997


             PNG (Portable Network Graphics) Specification
                              Version 1.0

Status of this Memo

   This memo provides information for the Internet community.  This memo
   does not specify an Internet standard of any kind.  Distribution of
   this memo is unlimited.

IESG Note:

   The IESG takes no position on the validity of any Intellectual
   Property Rights statements contained in this document.

Abstract

   This document describes PNG (Portable Network Graphics), an
   extensible file format for the lossless, portable, well-compressed
   storage of raster images.  PNG provides a patent-free replacement for
   GIF and can also replace many common uses of TIFF.  Indexed-color,
   grayscale, and truecolor images are supported, plus an optional alpha
   channel.  Sample depths range from 1 to 16 bits.

   PNG is designed to work well in online viewing applications, such as
   the World Wide Web, so it is fully streamable with a progressive
   display option.  PNG is robust, providing both full file integrity
   checking and simple detection of common transmission errors.  Also,
   PNG can store gamma and chromaticity data for improved color matching
   on heterogeneous platforms.

   This specification defines the Internet Media Type image/png.

Table of Contents

   1. Introduction ..................................................  4
   2. Data Representation ...........................................  5
      2.1. Integers and byte order ..................................  5
      2.2. Color values .............................................  6
      2.3. Image layout .............................................  6
      2.4. Alpha channel ............................................  7
      2.5. Filtering ................................................  8
      2.6. Interlaced data order ....................................  8
      2.7. Gamma correction ......................................... 10



Boutell, et. al.             Informational                      [Page 1]

RFC 2083            PNG: Portable Network Graphics            March 1997


      2.8. Text strings ............................................. 10
   3. File Structure ................................................ 11
      3.1. PNG file signature ....................................... 11
      3.2. Chunk layout ............................................. 11
      3.3. Chunk naming conventions ................................. 12
      3.4. CRC algorithm ............................................ 15
   4. Chunk Specifications .......................................... 15
      4.1. Critical chunks .......................................... 15
          4.1.1. IHDR Image header .................................. 15
          4.1.2. PLTE Palette ....................................... 17
          4.1.3. IDAT Image data .................................... 18
          4.1.4. IEND Image trailer ................................. 19
      4.2. Ancillary chunks ......................................... 19
          4.2.1. bKGD Background color .............................. 19
          4.2.2. cHRM Primary chromaticities and white point ........ 20
          4.2.3. gAMA Image gamma ................................... 21
          4.2.4. hIST Image histogram ............................... 21
          4.2.5. pHYs Physical pixel dimensions ..................... 22
          4.2.6. sBIT Significant bits .............................. 22
          4.2.7. tEXt Textual data .................................. 24
          4.2.8. tIME Image last-modification time .................. 25
          4.2.9. tRNS Transparency .................................. 26
          4.2.10. zTXt Compressed textual data ...................... 27
      4.3. Summary of standard chunks ............................... 28
      4.4. Additional chunk types ................................... 29
   5. Deflate/Inflate Compression ................................... 29
   6. Filter Algorithms ............................................. 31
      6.1. Filter types ............................................. 31
      6.2. Filter type 0: None ...................................... 32
      6.3. Filter type 1: Sub ....................................... 33
      6.4. Filter type 2: Up ........................................ 33
      6.5. Filter type 3: Average ................................... 34
      6.6. Filter type 4: Paeth...................................... 35
   7. Chunk Ordering Rules .......................................... 36
      7.1. Behavior of PNG editors .................................. 37
      7.2. Ordering of ancillary chunks ............................. 38
      7.3. Ordering of critical chunks .............................. 38
   8. Miscellaneous Topics .......................................... 39
      8.1. File name extension ...................................... 39
      8.2. Internet media type ...................................... 39
      8.3. Macintosh file layout .................................... 39
      8.4. Multiple-image extension ................................. 39
      8.5. Security considerations .................................. 40
   9. Recommendations for Encoders .................................. 41
      9.1. Sample depth scaling ..................................... 41
      9.2. Encoder gamma handling ................................... 42
      9.3. Encoder color handling ................................... 45
      9.4. Alpha channel creation ................................... 47



Boutell, et. al.             Informational                      [Page 2]

RFC 2083            PNG: Portable Network Graphics            March 1997


      9.5. Suggested palettes ....................................... 48
      9.6. Filter selection ......................................... 49
      9.7. Text chunk processing .................................... 49
      9.8. Use of private chunks .................................... 50
      9.9. Private type and method codes ............................ 51
   10. Recommendations for Decoders ................................. 51
      10.1. Error checking .......................................... 52
      10.2. Pixel dimensions ........................................ 52
      10.3. Truecolor image handling ................................ 52
      10.4. Sample depth rescaling .................................. 53
      10.5. Decoder gamma handling .................................. 54
      10.6. Decoder color handling .................................. 56
      10.7. Background color ........................................ 57
      10.8. Alpha channel processing ................................ 58
      10.9. Progressive display ..................................... 62
      10.10. Suggested-palette and histogram usage .................. 63
      10.11. Text chunk processing .................................. 64
   11. Glossary ..................................................... 65
   12. Appendix: Rationale .......................................... 69
      12.1. Why a new file format? .................................. 69
      12.2. Why these features? ..................................... 70
      12.3. Why not these features? ................................. 70
      12.4. Why not use format X? ................................... 72
      12.5. Byte order .............................................. 73
      12.6. Interlacing ............................................. 73
      12.7. Why gamma? .............................................. 73
      12.8. Non-premultiplied alpha ................................. 75
      12.9. Filtering ............................................... 75
      12.10. Text strings ........................................... 76
      12.11. PNG file signature ..................................... 77
      12.12. Chunk layout ........................................... 77
      12.13. Chunk naming conventions ............................... 78
      12.14. Palette histograms ..................................... 80
   13. Appendix: Gamma Tutorial ..................................... 81
   14. Appendix: Color Tutorial ..................................... 89
   15. Appendix: Sample CRC Code .................................... 94
   16. Appendix: Online Resources ................................... 96
   17. Appendix: Revision History ................................... 96
   18. References ................................................... 97
   19. Credits ......................................................100











Boutell, et. al.             Informational                      [Page 3]

RFC 2083            PNG: Portable Network Graphics            March 1997


1. Introduction

   The PNG format provides a portable, legally unencumbered, well-
   compressed, well-specified standard for lossless bitmapped image
   files.

   Although the initial motivation for developing PNG was to replace
   GIF, the design provides some useful new features not available in
   GIF, with minimal cost to developers.

   GIF features retained in PNG include:

       * Indexed-color images of up to 256 colors.
       * Streamability: files can be read and written serially, thus
         allowing the file format to be used as a communications
         protocol for on-the-fly generation and display of images.
       * Progressive display: a suitably prepared image file can be
         displayed as it is received over a communications link,
         yielding a low-resolution image very quickly followed by
         gradual improvement of detail.
       * Transparency: portions of the image can be marked as
         transparent, creating the effect of a non-rectangular image.
       * Ancillary information: textual comments and other data can be
         stored within the image file.
       * Complete hardware and platform independence.
       * Effective, 100% lossless compression.

   Important new features of PNG, not available in GIF, include:

       * Truecolor images of up to 48 bits per pixel.
       * Grayscale images of up to 16 bits per pixel.
       * Full alpha channel (general transparency masks).
       * Image gamma information, which supports automatic display of
         images with correct brightness/contrast regardless of the
         machines used to originate and display the image.
       * Reliable, straightforward detection of file corruption.
       * Faster initial presentation in progressive display mode.

   PNG is designed to be:

       * Simple and portable: developers should be able to implement PNG
         easily.
       * Legally unencumbered: to the best knowledge of the PNG authors,
         no algorithms under legal challenge are used.  (Some
         considerable effort has been spent to verify this.)
       * Well compressed: both indexed-color and truecolor images are
         compressed as effectively as in any other widely used lossless
         format, and in most cases more effectively.



Boutell, et. al.             Informational                      [Page 4]

RFC 2083            PNG: Portable Network Graphics            March 1997


       * Interchangeable: any standard-conforming PNG decoder must read
         all conforming PNG files.
       * Flexible: the format allows for future extensions and private
         add-ons, without compromising interchangeability of basic PNG.
       * Robust: the design supports full file integrity checking as
         well as simple, quick detection of common transmission errors.

   The main part of this specification gives the definition of the file
   format and recommendations for encoder and decoder behavior.  An
   appendix gives the rationale for many design decisions.  Although the
   rationale is not part of the formal specification, reading it can
   help implementors understand the design.  Cross-references in the
   main text point to relevant parts of the rationale.  Additional
   appendixes, also not part of the formal specification, provide
   tutorials on gamma and color theory as well as other supporting
   material.

   In this specification, the word "must" indicates a mandatory
   requirement, while "should" indicates recommended behavior.

   See Rationale: Why a new file format? (Section 12.1), Why these
   features? (Section 12.2), Why not these features? (Section 12.3), Why
   not use format X? (Section 12.4).

   Pronunciation

      PNG is pronounced "ping".

2. Data Representation

   This chapter discusses basic data representations used in PNG files,
   as well as the expected representation of the image data.

   2.1. Integers and byte order

      All integers that require more than one byte must be in network
      byte order: the most significant byte comes first, then the less
      significant bytes in descending order of significance (MSB LSB for
      two-byte integers, B3 B2 B1 B0 for four-byte integers).  The
      highest bit (value 128) of a byte is numbered bit 7; the lowest
      bit (value 1) is numbered bit 0. Values are unsigned unless
      otherwise noted. Values explicitly noted as signed are represented
      in two's complement notation.

      See Rationale: Byte order (Section 12.5).






Boutell, et. al.             Informational                      [Page 5]

RFC 2083            PNG: Portable Network Graphics            March 1997


   2.2. Color values

      Colors can be represented by either grayscale or RGB (red, green,
      blue) sample data.  Grayscale data represents luminance; RGB data
      represents calibrated color information (if the cHRM chunk is
      present) or uncalibrated device-dependent color (if cHRM is
      absent).  All color values range from zero (representing black) to
      most intense at the maximum value for the sample depth.  Note that
      the maximum value at a given sample depth is (2^sampledepth)-1,
      not 2^sampledepth.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -