png-chunks-extract

Extract the data chunks from a PNG file.

MIT License

Downloads
91.6K
Stars
35
Committers
1

png-chunks-extract

Extract the data chunks from a PNG file.

Useful for reading the metadata of a PNG image, or as the base of a more complete PNG parser.

Usage

chunks = extract(data)

Takes the raw image file data as a Uint8Array or Node.js Buffer, and returns an array of chunks. Each chunk has a name and data buffer:

[
  { name: 'IHDR', data: Uint8Array([...]) },
  { name: 'IDAT', data: Uint8Array([...]) },
  { name: 'IDAT', data: Uint8Array([...]) },
  { name: 'IDAT', data: Uint8Array([...]) },
  { name: 'IDAT', data: Uint8Array([...]) },
  { name: 'IEND', data: Uint8Array([]) }
]

License

MIT, see LICENSE.md for details.