LiraNuna's Development Blog
tileoptimize

Tileoptimize is a tool that is aimed to size-optimize tiled images for machines with multiple palettes.
Although the output is primarily made for GBA and NDS, it could be easily adjusted to output for other machines aswell (combined with gba2wsc for example).
The application will quantisize the colors of the image to NxM sized palette of M colors spreaded over N palettes,
resulting a more colorful image in smaller tile size with repeating tile and palette combinations to save size.

Usage: tileoptimize [OPTIONS] <input> <output>

Options are:

 -o[R|B|C]      Output type. Raw, Bitmap or C Code respectively
 -pNxM          Palette size: M palettes sized N colors each (Max 16×16)
 -aN            Average factor
 -D[0..3]       Dither type [0..3] None..Strong or no param to disable
 -T             Set tile transparency (default is magenta or pal0)

Defaults: -oB -p16x16 -a64 -D3

Size vs. Quality tradeof using an example background image.

gfx2gba output using 256 colors per tile output and optimized map:

$ gfx2gba -c256 -t8 -m level4Down.bmp
Number of tiles before optimization: 0768
Number of tiles after  optimization: 0253

Tiles binary size = 15.8 KB (16192 bytes)

tileoptimize output with dithering disabled and transparency enabled:

$ tileoptimize -oR -D -T level4Down.bmp level4Down_tileoptimize
Numbers of tiles before optimization: 0768
Numbers of tiles after  optimization: 0254

Tiles binary size = 7.9 KB (8128 bytes)

While gfx2gba outputs a nice tile-optimized image with high quality result, the image takes a lot of space in VRAM (Almost a full tilebase!). While both conversions generates a palette of 256 colors and a map in the same size, the tile count is nearly the same, while significantly smaller resulting almost the same quality visable to the naked eye.

Download HERE (Win32 binary and Linux binaries included).