NPF is an indexed image format used for small online images, including previews and icons. It begins with a UGAR header containing section lengths for palette and image data. The format uses four-bit palette indices, giving sixteen slots; index zero is treated as transparent. [1]
Stored width versus display width
The encoded row width is rounded up to a power of two. A 50-pixel-wide image, for example, can occupy a 64-pixel row in storage and then be clipped to 50 pixels by the page layout. If a reader advances by the visible width, every later row will start in the wrong place. The width in an HTML element is presentation metadata, not a byte count in the NPF header. [1]
Nibble order and palette
Two pixels share a byte. The published description stores the earlier pixel in the low nibble, so test a two-colour alternating fixture before importing a large image. Palette colours use RGB555 words; the value in palette slot zero does not determine the transparency colour. [1]
Operational limits
NPF's lower colour depth makes it smaller than direct-colour NTFT, but a page can still exhaust client image memory. Bound dimensions and decoded bytes before allocating. The wiki reports observed per-page counts, not a universal promise for every regional build or layout. [1]
Image storage and page limits
NPF has sixteen palette slots. Index zero is transparent, leaving fifteen visible colours. Stored row width rounds up to a power of two, while HTML can clip the displayed image to a narrower width. In one wiki test, a page held around 21 images at 128 × 92 pixels, compared with roughly five NTFT or TMB images. Those figures describe that test and should not be used as limits for every page. [2]
NPF's complete section header
Read the three integer fields below as little-endian unsigned 32-bit values. Section one is the RGB555 palette, and section two contains packed four-bit indices. No width or height is present in this header. [1]
| Offset | Bytes | Meaning |
|---|---|---|
| 0x00 | 4 | ASCII UGAR |
| 0x04 | 4 | Section count; the documented form is 2 |
| 0x08 | 4 | First section's byte length |
| 0x0C | 4 | Second section's byte length |
Resolve nibbles before resolving colours
For byte 0xA3, the earlier pixel uses palette index 3 and the next uses index 10. Index zero is transparent, regardless of the colour word occupying palette slot zero. The file can therefore provide fifteen visible palette colours in addition to transparency. [1]
The wiki also says the first byte of the palette is ignored. This is unclear because RGB555 entries are two bytes long and index zero is transparent. It may be imprecise wording or a separate behaviour of the original reader. A sample or the reader's code is needed to decide; adding a one-byte prefix based on that sentence alone would be a guess. [1]
Display use and measured capacity
Typical uses include Flipnote thumbnails and simple icons. The wiki also describes using NPF with the historical table-overflow layout bug to place a bottom-screen background. This concerns browser layout rather than a separate NPF image mode. See browser compatibility hazards. [1]
The reported capacity test used approximately twenty-one NPF images of 128 × 92 pixels on a page. The comparison was around five NTFT images or five TMB previews per page. Other sizes or layouts may reach different memory limits. [1]
Example: visible width and padding
The colours in this diagram mark the visible pixels and padding. The padding pixels can have other colours in the file. Only one row is shown.
For the wiki’s 50-pixel example, the stored row spans 64 pixels. At two pixels per byte, that is 32 bytes for each stored row. Supplying width="50" in the image element crops the final 14 columns from view. This calculation covers the image data. The UGAR header and palette take up additional space. [1]
