bmp2tiles 20051117
Converts bitmap images to tile formats for various consoles
by Damian Yerrick

_____________________________________________________________________
Introduction

Video game consoles tend to store images as a collection of 8x8 pixel
tiles instead of as a linear bitmap.  This converts an indexed bitmap
image from BMP, PCX, or TGA format to any of several consoles' tile
formats.  Future versions may also be capable of adding palette
information to the data.

_____________________________________________________________________
Requirements

The included binary is for Microsoft Windows.  It requires the
Allegro DLL available from http://www.pineight.com/pc/ so put
alleg40.dll in the same folder as bmp2tiles.exe.

It _should_ be easily portable to linux, mac os, msdos, or any other
platform supported by the Allegro library.

_____________________________________________________________________
Invoking

Usage: bmp2tiles [options] infile outfile
Converts infile (an indexed .bmp or .pcx image) to outfile (a binary file
in a format for use with a game console).
Optionally segments image into cels before conversion.

Options:
  -a            Append tile data to outfile (default: overwrite outfile)
  -b fmt        Convert image to tile format fmt (default: 1bpp)
  -W width      Individual cels are width pixels wide (default: 8)
  -H height     Individual cels are height pixels tall (default: 8)

The -b option controls the output format. See "Format descriptions".

The -W and -H option are useful for sprite sheets, where you can
specify the width and height of a cel, or for systems that use
hardware sprites larger than 8x8 pixels (such as the 8x16 modes of
the NES and Sega Genesis).

As with all command-line programs, you need to use the full path
to the program, or you need to make sure you have bmp2tiles.exe in
a folder on your PATH.

Example:

bmp2tiles -b gba -W 32 -H 32 kitty.bmp kitty.chr

_____________________________________________________________________
Format descriptions

These format names are used with -b.

Planar formats:

Name    Synonym Description
------- ------- -----------------------------------------------------
1bpp    pc      1 bit per pixel, left to right, big-endian
nes             Two 1bpp planes
gb              Two 1bpp planes interleaved by row
sms             Four 1bpp planes interleaved by row
snes    pce     Two gb planes not interleaved
snes3           A gb plane followed by a 1bpp plane
snes8           Four gb planes

Packed formats:

Name    Synonym Description
------- ------- -----------------------------------------------------
vb              2 bits per pixel, right to left, little endian
ngpc            2 bits per pixel, left to right, little endian
nhl             3 bits per pixel, left to right, big endian
genesis         4 bits per pixel, left to right, big endian
gba             4 bits per pixel, right to left, little endian
8bpp    mode7   8 bits per pixel, left to right

_____________________________________________________________________
Legal

Copyright 2005 Damian Yerrick

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.

