{
  "id": 17674447,
  "title": "Nibnib: Image compression with extreme decompression speed",
  "url": "https://urgent.news/2026/10/30/nibnib-image-compression-with-extreme-decompression-speed",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-30T04:17:06.000Z",
  "source": {
    "name": "Hacker News",
    "slug": "hacker-news",
    "url": "https://github.com/raphlinus/nibnib"
  },
  "original_language": "en",
  "account": "Nibnib is an image compression format designed specifically for its exceptional decompression speed. Originating as an experiment to test image quality and performance on an RP2350 microcontroller, nibnib is often used in low-bit depth images and palette lookup scenarios. With a limited budget of around 6 cycles per pixel, the format manages to decode two pixels simultaneously from a single byte of input, resulting in 4bpp compression. The decoding process is straightforward and deterministic, with each decoded pixel being doubled up before fetching a byte from the input stream to add to the pixel's value, ultimately yielding two 16bpp pixels in RGB 565 format.\n\nEncoding in nibnib is a more complex process, involving a search through possible encoded images to find one that closely matches the original. The current encoder is significantly slower than the decoding process, which allows for greater optimization in the decoding phase. Two main aspects of the search are the choice of palette and the selection of codewords.\n\nThe palette used in nibnib is a cube of delta values, with a block of random values added for added flexibility. This structure ensures proper handling of edge cases without risking overflow. The encoding loop attempts all 256 palette entries, choosing the one with the minimum error and distributing it using Floyd-Steinberg weights. Subsequent pixels are based on the source pixel value plus weighted errors from previous iterations.\n\nThe format is relatively simple, consisting of 2 bytes for width and height, followed by 256 32-bit palette entries, and then the image rows in order. Each row starts with two RGB 565 pixels, followed by ((width - 2) / 2) bytes indexing the palette. The row stride is rounded up to a multiple of 4 bytes. Currently, the format does not support additional metadata, as it is primarily intended for tight integration with the decoder.\n\nDespite its simplicity, nibnib's performance is impressive, offering 4bpp compression with extreme decompression speed, making it an ideal choice for scenarios where speed is a critical factor.",
  "summary": null,
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}