Skip to content

.npf image format

James edited this page Feb 15, 2016 · 5 revisions

##Overview NPF images are much more lightweight at the expense of

This image format uses indexed color.

##Format documentation

####Header

Start Length Type Description
0 4 Magic "UGAR"
4 4 uint32 LE Section count - always 2
8 4 uint32 LE Section 1 (palette data) length
12 4 uint32 LE Section 2 (image data) length

####Palette Data

Colors are stored in rgb555 format, so that each color only uses two bytes of data.

The first byte of this section is actually ignored, as palette index 0 is reserved for transparent pixels. Because of this, there are only 15 color palette slots available.

####Image Data

Each pixel of the image is represented by a one-byte unsigned integer that refers to the index of the color in the palette section. The indices start at 0, like an array.

Images are read using a scanline method. The data starts with the pixel at the top-left, then progresses linearly left-to-right, top-to-bottom until the pixel in the bottom-right corner.

##Things to investigate

  • Can we use these from ugomenus as well?
  • Is it possible to use a shorter palette length if not all 256 color slots are used?