pngChunkRefined(): Coder<>
Creates a coder for PNG chunks with type-specific refinement.
This coder automatically detects the chunk type and applies the appropriate refiner, transforming raw chunk data into structured objects for known chunk types (IHDR, PLTE, tRNS, bKGD, IDAT, IEND). Unknown chunk types are passed through as PngChunkUnknown.
Decode a PNG with refined chunks
Decode a PNG with refined chunks
import { assert } from "@std/assert"; import { pngChunkRefined, pngFileChunks } from "@binstruct/png"; const coder = pngFileChunks(pngChunkRefined()); // When decoding a PNG file, chunks will be automatically refined // to their specific types (IhdrChunk, PlteChunk, etc.) assert(typeof coder.decode === "function"); assert(typeof coder.encode === "function");