PNG and APNG features

The following features are supported for PNG and APNG:

Headers

The "headers" feature for PNG and APNG exports all data from the header chunks (all chunks which are not IDAT or fdAT).

Each type of chunk exports an object with the name of its tag. For chunks that may appear multiple times, an Array is exported instead of an object.

I won’t go into detail for each field in each header. You should read the PNG specification for that.

TODO: number
TODO: string
TODO: an Array with 3 numbers: [ red, green, blue ]
TODO: an Array of numbers with the histogram
TODO: an Array with 5 numbers: [ red, green, blue, alpha, frequency ]
TODO: depending on IHDR.color_type:

  • 0 or 4: an Object with 1 number: "grey"
  • 2 or 6: an Object with 3 numbers: "red", "green", and "blue"
  • 3: an Array with numbers

TODO: depending on IHDR.color_type:

  • 0: an Object with 1 number: "grey"
  • 2 or 3: an Object with 3 numbers: "red", "green", and "blue"
  • 4: an Object with 2 numbers: "grey" and "alpha"
  • 6: an Object with 4 numbers: "red", "green", "blue", and "alpha"

TODO: depending on IHDR.color_type:

  • 0: an Object with 1 number: "grey"
  • 2: an Object with 3 numbers: "red", "green", and "blue"
  • 3: an Array with numbers

TODO: an Array of bytes with custom (decompressed) zlib data
TODO: a string (possibly decompressed zlib data, depending on the flag field)

Image Data

The "idat" feature for PNG and APNG exports all image data (IDAT and fdAT chunks).

NOTE: interlaced PNG images will have a "passes" array instead of "rows". It works differently, using Adam7 interlacing. Each pass has a different number of bytes in the row (TODO: describe).

TODO: row:

  • Each row of image data is an Array with numbers.
  • The first value in the Array is the filter_type, which can be
    • 0: None
    • 1: Sub
    • 2: Up
    • 3: Average
    • 4: Paeth
  • All subsequent values in the Array are numbers that represent the image data compressed with the filter_type above.

TODO: number:

  • The "compression_level" field will instruct FFglitch on what compression level to use in the zlib library to compress the data. Default is -1, and values may go from 0 (no compression) to 9 (best compression).

TODO: number:

  • fdAT chunks have an extra sequence_number field.