Hocus Pocus Image Format

From ModdingWiki
Jump to navigation Jump to search
Hocus Pocus Image Format
There is no example of an image in this format — upload one!
Format typeImage
Colour depth8-bit (VGA)
Minimum size (pixels)0×0
Maximum size (pixels)262140×65535
Plane count4
Transparent pixels?No
Hitmap pixels?No

File format

Hocus Pocus image files contain a header with two UINT16LE values, followed by four blocks of interleaved 8bpp pixel values. As there is no palette data stored in the image files, the current game palette should be used when the image is to be displayed or converted. The one exception to this rule is the file REGIST.IMG, which uses the palette from the title screen TITLE.PCX.

The first UINT16LE value in the header contains an interleaved width value (iWidth4). Multiply this by 4 to get the actual image width in pixels. The second UINT16LE value stores the image height in pixels (iHeight). The image data can be divided into four blocks, each containing iWidth4 × iHeight bytes, with each byte being a colour index into the palette. The indices in the first block are for those pixels where x mod 4 = 0, the data from the second block for pixels where x mod 4 = 1, and so on.

A simple way to identify an image file is to read iWidth4 and iHeight and then check if iWidth4 * iHeight * 4 + 4 matches the size of the file.