Png.xml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <?xml-stylesheet type="text/xsl" href="../Xsl/doc2html.xsl"?>
  3. <doc>
  4. <title>Portable Network Graphics File Format</title>
  5. <chapter>
  6. <title>Portable Network Graphics File Format</title>
  7. <par>
  8. PNG is extensible file format for the lossless, portable, well-compressed
  9. storage of raster images. PNG provides a patent-free replacement for GIF and can also
  10. replace many common uses of TIFF. Indexed-color, grayscale, and truecolor images
  11. are supported, plus an optional alpha channel. Sample depths range from 1 to 16 bits.
  12. </par>
  13. <par>
  14. Images can also be filtered using different lossless filter for each scanline so that
  15. subsequent compression can produce even smaller images. PNG also supports interlaced
  16. images to allow progressive display.
  17. Imaging can load all possible PNG data formats but cannot save 1, 2, and 4 bit or
  18. interlaced images. It supports all filters when loading or saving images.
  19. Imaging uses <b>ZLib</b> library written by Jean-loup Gailly and Mark Adler
  20. to compress and decompress PNG image data.
  21. It was translated to Pascal by Jacques Nomssi Nzali.
  22. </par>
  23. <par>
  24. As of version 0.26.4, Imaging also supports APNG format.
  25. APNG is unofficial extension of PNG image file format created by two guys from Mozilla Corporation.
  26. The point of APNG is to allow storing simple animations in PNG files (hence the "A" for "Animated").
  27. There is already PNG-like chunk based format for animations called MNG
  28. (already supported by Imaging - at least the basic features).
  29. However, MNG is quite complex format and its support among browsers and image viewers/editors is lacking.
  30. Code library supporting all MNG features is huge.
  31. APNG on the other hand is just an extension of PNG and its implementation is not so complex. Imaging can load APNG files, animate them (optional - put frames
  32. at desired positions, blend frames, apply disposal methods),
  33. and also save multiple images as single APNG file.
  34. </par>
  35. <table>
  36. <title>Portable Network Graphics File Format Support</title>
  37. <row>
  38. <th>Format</th>
  39. <th>TImageFormat equivalent</th>
  40. <th>Loading</th>
  41. <th>Saving</th>
  42. </row>
  43. <row>
  44. <td>1 bit indexed</td>
  45. <td><icode>ifIndex8</icode></td>
  46. <td>Yes</td><td>No</td>
  47. </row>
  48. <row>
  49. <td>2 bit indexed</td>
  50. <td><icode>ifIndex8</icode></td>
  51. <td>Yes</td><td>No</td>
  52. </row>
  53. <row>
  54. <td>4 bit indexed</td>
  55. <td><icode>ifIndex8</icode></td>
  56. <td>Yes</td><td>No</td>
  57. </row>
  58. <row>
  59. <td>8 bit indexed</td>
  60. <td><icode>ifIndex8</icode></td>
  61. <td>Yes</td><td>Yes</td>
  62. </row>
  63. <row>
  64. <td>24 bit RGB</td>
  65. <td><icode>ifR8G8B8</icode></td>
  66. <td>Yes</td><td>Yes</td>
  67. </row>
  68. <row>
  69. <td>48 bit RGB</td>
  70. <td><icode>ifR16G16B16</icode></td>
  71. <td>Yes</td><td>Yes</td>
  72. </row>
  73. <row>
  74. <td>32 bit ARGB</td>
  75. <td><icode>ifA8R8G8B8</icode></td>
  76. <td>Yes</td><td>Yes</td>
  77. </row>
  78. <row>
  79. <td>64 bit ARGB</td>
  80. <td><icode>ifA16R16G16B16</icode></td>
  81. <td>Yes</td><td>Yes</td>
  82. </row>
  83. <row>
  84. <td>1 bit grayscale</td>
  85. <td><icode>ifGray8</icode></td>
  86. <td>Yes</td><td>No</td>
  87. </row>
  88. <row>
  89. <td>2 bit grayscale</td>
  90. <td><icode>ifGray8</icode></td>
  91. <td>Yes</td><td>No</td>
  92. </row>
  93. <row>
  94. <td>4 bit grayscale</td>
  95. <td><icode>ifGray8</icode></td>
  96. <td>Yes</td><td>No</td>
  97. </row>
  98. <row>
  99. <td>8 bit grayscale</td>
  100. <td><icode>ifGray8</icode></td>
  101. <td>Yes</td><td>Yes</td>
  102. </row>
  103. <row>
  104. <td>16 bit grayscale</td>
  105. <td><icode>ifGray16</icode></td>
  106. <td>Yes</td><td>Yes</td>
  107. </row>
  108. <row>
  109. <td>16 bit grayscale + alpha</td>
  110. <td><icode>ifA8Gray8</icode></td>
  111. <td>Yes</td><td>Yes</td>
  112. </row>
  113. <row>
  114. <td>32 bit grayscale + alpha</td>
  115. <td><icode>ifA16Gray16</icode></td>
  116. <td>Yes</td><td>Yes</td>
  117. </row>
  118. </table>
  119. <par>
  120. When working with PNG files you can find useful some options
  121. which can be set by <ref>SetOption</ref> function and their current values
  122. can be get by <ref>GetOption</ref> function.
  123. Or you can set them by modifying properties of <ref>TPNGFileFormat</ref>
  124. class.
  125. </par>
  126. <table>
  127. <title>Options Related to PNG Files</title>
  128. <row>
  129. <th>OptionId</th>
  130. <th>Allowed Values</th>
  131. <th>Usage</th>
  132. </row>
  133. <row>
  134. <td><ref>ImagingPNGPreFilter</ref></td>
  135. <td><b>0, 1, 2, 3, 4, 5, 6</b></td>
  136. <td>Sets precompression filter used when saving PNG images. Allowed values
  137. are:
  138. <list>
  139. <li>0 - None Filter</li>
  140. <li>1 - Sub Filter</li>
  141. <li>2 - Up Filter</li>
  142. <li>3 - Average Filter</li>
  143. <li>4 - Paeth Filter</li>
  144. <li>5 - Use 0 for indexed/gray images and 4 for RGB/ARGB images</li>
  145. <li>6 - Adaptive filtering - use best filter for each scanline - very slow</li>
  146. </list>
  147. Note that filters 3 and 4 are much slower than filters 1 and 2.
  148. Default value is <b>5</b>. </td>
  149. </row>
  150. <row>
  151. <td><ref>ImagingPNGCompressLevel</ref></td>
  152. <td><b>0 (no compression)</b> to <b>9 (best compression)</b></td>
  153. <td>Sets ZLib compression level used when saving PNG images.
  154. Default value is <b>5</b>. </td>
  155. </row>
  156. <row>
  157. <td><ref>ImagingPNGLoadAnimated</ref></td>
  158. <td><b>0 (false)</b> or <b>1 (true)</b></td>
  159. <td>Boolean option that specifies whether PNG images with more frames (APNG format)
  160. are animated by Imaging (according to frame disposal/blend methods) or just
  161. raw frames are loaded and sent to user (if you want to animate APNG yourself).
  162. Default value is <b>1</b>. </td>
  163. </row>
  164. </table>
  165. </chapter>
  166. </doc>