Amiga ILBM files


This image (MEDUSABL.IFF) is one of the few Atari ST IFF files I could find on the web, it is quite typical of the graphics of the time: low resolution, 4 bit palette.

The next big thing after the Commodore 64 was, of course the Amiga. While a 16 bit processor with a 8 7 Mhz clock is something you use for a washing machine today, in those days it was something awesome. The Amiga was renowned for its graphical capacities as it could display more than the 16 fixed colours of the C64.

One graphical mode that was particular interesting was Hold and Modify (HAM), which enabled the display of up to 4096 colours in a fixed image using only 6 bits per pixel (8 in later versions). HAM is basically a hack, where each pixel can either be looked-up in a colour table (the standard way of doing things in those days), or re-use (hold) the colour of the previous pixel and modify the value of one of the channels (Red, Green, or Blue), hence the name Hold and Modify.

The graphical image format of the Amiga was , a particular instance of the . I wanted to see if I could write a parser for the IFF/ILBM format that would read directly the original file and display it in an HTML5 canvas. It was a fun project, as the ILBM format stores image data in a way that is completely different from the way things are done nowadays: instead of storing all the bits for a given pixel together, they are split between bitplanes, each pixel is represented by a single bit in multiple bitplanes. This was related to the way Denise, the graphical chip of the Amiga, handled graphics. I also had to write code to decompress the data.

Interestingly this format shares some technology with the Macintosh: IFF reuses the idea of 32 bit type codes adopted by the Mac, and in return the Mac used a IFF based format for sounds, AIFF. ILBM also uses the compression introduced by Apple. The IFF format still survives in a way: the WebP format uses the RIFF container, which is basically the little endian version of IFF.

Anyway, I managed to get something that works, the code can load and display both palette and HAM ILBM files. I could not write code that handles HALFBRITE format because I did not find any example image. My code parses the palette animation tables, but does not perform the animation, although it looks like it is possible: this blog post shows some impressive colour table animations using the gorgeous art of Mark Ferrari, it also uses ILBM files as a source, but pre-converts the data in JSON.

You can find the standalone image visualisation web page here and the javascript library that does the work here, the library is distributed under the BSD license.

Edit: changed the frame page code to be a bit more generic.
Edit: the library now has its own page, it now supports animations and EHB images.

12 thoughts on “Amiga ILBM files”

  1. Ahah j’en avais dessiné un paquet à l’époque, je les ai encore. Mais pas en HAM, qui donnait d’affreux artefacts, ni en Extra Halfbrite, qui n’était pas tellement utilisable.
    Et il y avait ces résolutions bizarres avec des pixels rectangulaires. Comment ferais-tu pour les afficher correctement ?
    Tu peux toujours créer des images, avec un émulateur et Deluxe Paint.

  2. Pour les pixels rectangulaires, le code ajuste le ratio de l’image de manière à ce qu’un pixel de l’image fasse toujours au moins un pixel web et j’affiche l’image en respectant le ratio donné dans l’image, l’interpolation des pixels est déléguée au browser web qui fait en général ça très bien. À noter qu’un pixel web n’est pas un pixel natif, donc sur un écran «retina» un pixel ILBM peut très bien avoir 2 pixels de haut, et 3 de large.

  3. Very interesting post. There are some slight inacuracies. Amiga was 7 MHz. Atari in the other hand was 8 MHz. HAM is a 6 bit per pixel mode (in its original design). Later HAM8 was introduced with AGA machines. HalfBright is also a 6 bpp but with 32 free colors in the palette, the other 32 colors are deduced by halfing the compound of the free ones.

  4. Hi there, awesome JS library you wrote! I yet have to dive into your code a bit more, but I was wondering whether it’s possible to grab the (canvas) output and save it to a PNG file.

    Maybe you can give a glimpse on how to do that… I have some experience in JS and coding but am not very up-to-date on the possibilities of the canvas, and it’s not very clear how you output the image to the canvas (do you send pixels to the canvas or do you generate a PNG including all headers and dump that to the browser?).

    I have about 5000 IFF images, brushes and animations i’d like to convert to PNG (prefered within the browser). Thanks!

Leave a Reply to ThiasCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.