Refined IHDR (Image Header) chunk structure.
The IHDR chunk is the first chunk in a PNG file and contains critical image metadata including dimensions, bit depth, color type, and compression settings.
Example 1
Example 1
import { assertEquals } from "@std/assert"; import type { IhdrChunk } from "@binstruct/png"; const ihdr: IhdrChunk = { length: 13, type: "IHDR", data: { width: 100, height: 100, bitDepth: 8, colorType: 2, // RGB compressionMethod: 0, filterMethod: 0, interlaceMethod: 0, // No interlacing }, crc: 0x12345678, }; assertEquals(ihdr.data.width, 100); assertEquals(ihdr.data.colorType, 2);