interface IhdrChunk
extends Omit<PngChunkUnknown, "type" | "data">

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.

Examples

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);

Properties

type: "IHDR"

Chunk type identifier, always "IHDR"

data: { width: number; height: number; bitDepth: number; colorType: number; compressionMethod: number; filterMethod: number; interlaceMethod: number; }

Parsed image header data

Usage

import { type IhdrChunk } from ".";