Refined IDAT (Image Data) chunk structure.
The IDAT chunk contains the compressed image data. Multiple IDAT chunks can appear in a PNG file, and their data should be concatenated before decompression.
Example 1
Example 1
import { assertEquals } from "@std/assert"; import type { IdatChunk } from "@binstruct/png"; const idat: IdatChunk = { length: 100, type: "IDAT", data: { header: { compressionMethod: 8, compressionInfo: 7, fcheck: 1, fdict: 0, flevel: 2, }, uncompressed: new Uint8Array([4, 5, 6]), checksum: new Uint8Array([0x12, 0x34, 0x56, 0x78]), }, crc: 0x87654321, }; assertEquals(idat.type, "IDAT"); assertEquals(idat.data.header.compressionMethod, 8);