title: PNG File Filtering Method
body: <p>So reading PNG file specification indicates that before compression, the image is filtered. Currently only filtering method 0 is defined (2nd last byte in IHDR chunk). Method 0 has 5 sets of filtering functions:</p>
  
  <p>0 = None<br>
  1 = Sub<br>
  2 = Up<br>
  3 = Average<br>
  4 = Paeth  </p>
  
  <p>When decoding such data, would only interlaced PNG images have filter types other than 0? Here's a same data after decompression:</p>
  
  <pre><code>00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
  -----------------------------------------------
  00 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f
  7f 7f 7f 7f 7f 7f 10 0f 22 22 7f 7f 7f 7f 7f 7f
  7f 00 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f
  7f 7f 13 43 07 11 38 2e 2d 33 25 29 09 62 1b 7f
  7f 7f ...
  </code></pre>
  
  <p>Note the <code>00</code> every 32 bytes that indicates a "None" filtering scheme. My question is, would this only appear for non-interlaced images? Does this mean interlaced images would have filtering functions 1, 2, 3, or 4? If so, during my decoding, I'd have to read in 33 bytes and take the first one and tests if it's 0x01, 0x02, 0x03, or 0x04 to see which filter function to use?</p>