Hocus Pocus Image 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.