Skip to content

.nbf image format

James edited this page Feb 15, 2016 · 9 revisions

##Overview This format is used exclusively for top screen background images. Like the other image formats used by the app, they do not contain any dimension information, as such they are presumed to be 256 x 192 pixels.

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.

This section should be padded to 512 bytes regardless of whether or not all 256 color slots are needed -- the image may not be read correctly otherwise.

####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.

##Notes

  • These can be used from both HTML and ugomenus

##Things to investigate

  • Is it possible to use a shorter palette length if not all 256 color slots are used?