Jump to content

BAMU File Format


Recommended Posts

BAMWorkshopII supports an unpaletted BAM format (BAMU) and has the following to say about it:

---------------------------
0.3 Alpha Changelog
---------------------------
IMPORTANT NOTE
There is a new file format availble now: the Unpaletted BAM (or BAMU). BAMUs do NOT work with any infinity engine game, however they serve two purposes:

Firstly, they allow the user to create images without first having to decide on the palette colours and serve as a good way to save "work in progress"; the user can convert them to a paletted BAM later and get (hopefully) an optimised palette.

Secondly BAMUs will hopefully be included in the "Beyond Infinity" project, a TeamBG project to create a new engine capable of powering games designed for the Infinity Engine but with greater flexibility.

CHANGE LOG:
o REDID Copy/paste: unpaletted data may now be pasted in (i.e. from external applications)
o ADDED Mouse Wheel scroll: used to zoom image
o ADDED Unpaletted BAM format
o ADDED Paletted<-->Unpaletted conversions
o ADDED Transparent View

New TODO Items:
o Frame Optimisation (i.e. RLE on/off)
o Multi select in frames mngr
o Free Rotations

KNOWN ISSUES:
o BAMU --> BAM palette optimisation is flawed. I'm working on it.
---------------------------
OK
---------------------------

 

"Beyond Infinity" sounds suspiciously like GemRB. Was this format ever implemented anywhere, or does any further documentation about it exist? Looking at a BAMU, the Header looks like:

Offset     Size (data type)     Description
0x0000     4 (char array)     Signature ('BAMU')
0x0004     4 (char array)     Version ('V1  ')
0x0008     2 (word)     Count of frame entries
0x000a     1 (unsigned byte)     Count of cycles
0x000b     1 (unsigned byte)     The compressed colour index for RLE encoded bams (ie. this is the colour that is compressed)
0x000c     4 (dword?)    Unknown field.  One observed value is 0xFF0000FF
0x0010     4 (dword)     Offset (from start of file) to palette
0x0014     4 (dword)     Offset (from start of file) to frame entries (which are immediately followed by cycle entries)
0x0018    4 (dword)     Offset (from start of file) to frame lookup table

Note I’m unsure what the 4 bytes at 0x000c are for. Any ideas?

 

OffsetToPalette is usually/always 0, and no palette appears to be stored in the file.

 

Otherwise, Frame Entries, Cycle Entries, and Frame Lookup Table sections are the same as in BAM V1, except that frames do not have RLE. Frame data is stored as 24bpp in the RGB order, and has no scanline padding.

Link to comment

Very interesting. Eh, does it work at all? I mean the unpaletted BAM thing, forcing it to a palette? That's sort of our pipe dream, and I thought you achieved it elsewhere, or did you?

The command-line tool I'm writing uses a modified median cut algorithm I wrote and seems to produce results comparable to ImageMagick without dithering. The quantization algorithm supports the alpha channel, but I haven't really tested how good the results are. I built in the ability to weight the different channels differently, so some tweaking of the default settings may or may not be in order. My tool can read BAM, BAMC, BAMU, and BAMD files and save them as BAM or BAMC files, optionally with quite extensive compression. It can also save files as BAMDs or animated GIFs, and can export and import palettes in a variety of formats including PAL, ACT, BMP, visual BMP, and raw. I natively support GIF and some BMP variants in imports and exports, and use GDIplus for the rest which means BMP, DIB, RLE, JPG, JPEG, JPE, JFIF, GIF, TIF, TIFF, and PNG are also supported, although import isn't as fast. There are a few more things I'm still working on (like importation of animated GIFs), but I'm working towards an alpha release. I hear rumors that Beamdog will be releasing another of their in-house BAM tools soonish. As nice as that sounds, I kind of hope it doesn't render this little pet project of mine obsolete. I have put quite a bit of time into it over the years.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...