AVS Image Format

Written by Paul Bourke
January 2001

The AVS image format (usul extension of ".x") is pretty straightforward. It consists of an 8 byte header followed by a,r,g,b per pixel, ordered top to bottom, left to right. (a == alpha, r == red, g = reen, b == blue) Each colour/alpha component is 1 unsigned byte. The header simply consists of the width and height of the image, each as 4 byte unsigned integers.

Note the format assumes a byte ordering as per SGI/Macintosh/Motorola processors, if reading an AVS image from a machine with the opposite byte ordering then the appropriate byte swapping is required (see the swapping in the C code below).

Some crude C code to read a AVS image file and write a raw (rgb only) file is given here: xtoraw.c or a slightly better version creating a TGA file, x2tga.c.

If you write a converter and want an image to test it on, try this one: mandrill.x.gz. It is 500x480 pixels.