AOP v1.0 File Format Details


FieldSize (bytes)Description
AOP3File Identifier - "AOP" char string
Version2Version - "10" char string
Filesize4Filesize as int32
Number of objects1[1..100]
Minimal zoom2(value in per mille) as short int (16 bits)
Maximal zoom2(value in per mille) as short int (16 bits)
Reflection10x00 for no reflection, 0x01 for reflection
Reserved16*Number of objectsFilled with 0x00s
RGB image pointer4Pointer to the start of the RGB JPEG image inside the file as int32
Alpha image pointer4Pointer to the start of the alpha JPEG image inside the file as int32
TitleVariableTitle string of the object pack. (No 0x00 at the end required)
RGB ImageVariableColor JPEG image (not alpha premultiplied)
Alpha ImageVariableGrayscale JPEG image

*All numbers in little endian

Image format

All the objects are contained inside one image. The image is 3,000x3,000 pixels. The image is divided in a 10x10 grid of 300x300 pixels per square. Every square can contain an object. The objects are placed in the grid in order, from left to right and up to down, like in this example:

You can download a checkerboard grid here, to use it for reference as background in an image editor.

The image is divided in two JPEG format images; one for the RGB channels and one for the alpha channel. The RGB image is not alpha premultiplied, and the alpha image is a grayscale/one channel JPEG where black means full transparency and white full opacity. Both images must be JPEG JFIF and 8bits per channel.


Maximal and minimal zoom factor

Both are expressed as per milles in short integer format. An example could be: min. zoom = 300 and max. zoom = 800. It would make the objects render in a size ranging from 30% to 80% of the original size.
*I recommed to have a maximum zoom equal or lower than 800 to avoid blurry results.


This option allows the renderer to use the mirrored versions of the objects. Setting it on usually provide better results, but there are some cases where it is not desirable (e.g. objects with text).

Sub-versions of AOP v1

Future sub-versions of AOP v1 will change only the reserved space to add per object details. That should make any AOP v1.0 program forward compatible with future AOP v1 sub-versions.

AOP output coding example in PHP



$title="Test Object Pack";

function write_little_endian($handle, $number, $byte_length)
	for ($n=0; $n<$byte_length; $n++)
		fwrite($handle, chr($number&0xff));

$handle = fopen($output_file, "wb");

$image=file_get_contents($rgb_file, FILE_BINARY);
$alpha=file_get_contents($alpha_file, FILE_BINARY);

fwrite($handle, "AOP");
fwrite($handle, $aop_version);
write_little_endian($handle, ($num_objects*16+23+strlen($title)+strlen($image)+strlen($alpha)), 4);
write_little_endian($handle, $num_objects, 1);
write_little_endian($handle, $zoom_min, 2);
write_little_endian($handle, $zoom_max, 2);
write_little_endian($handle, $reflection, 1);
for ($n=0; $n<$num_objects*16; $n++)
	fwrite($handle, chr(0));
write_little_endian($handle, $num_objects*16+23+strlen($title), 4);
write_little_endian($handle, $num_objects*16+23+strlen($title)+strlen($image), 4);
fwrite($handle, $title);
fwrite($handle, $image);
fwrite($handle, $alpha);