Another fun bit about image formats

Since I have nothing better to do (or the pending stuff makes me thinks I have nothing better to do), I search for a game to look at (preferably with a custom video format with an extension starting with ‘o’, ‘w’ or ‘y’ but any undocumented custom video format would do).

One of those games was Blood & Lace (despite the name it’s not about somebody cutting fingers while trying to put shoes on; whatever—I mostly study games, not play them). It had some videos using Indeo 4 or 5 plus some animations apparently on the game engine. Those were compressed as well as all TGA files. So out of curiosity I looked at the binary specification and apparently most of the files are compressed with LZH (the old compression method with dynamic Huffman coding used in LHA) using custom header starting with JFX1. And TGA files use JGF5 header which is almost the same but has image width and height in it before LZH-compressed data.

That’s another one in my collection of common LZ77-based methods used in multimedia compression, I wonder what will be next.

5 Responses to “Another fun bit about image formats”

  1. nin says:

    hey man, i am trying to mod a game made in the same engine, and i need to decompress the tga files and the videos (which i don’t know the extension of, probably a renamed ivf).
    how did you go about decompressing the files? what tools did you use?

  2. Kostya says:

    I simply used Ghidra to look at the game engine, found the decompression code and it was a combination of LZSS (using 0x20 fill no less, another sign of its origin) and adaptive Huffman coding. So of course I thought about LHA.

    In theory you can simply adapt any existing open-source unpacker (like https://lhasa.soulsphere.org/ ) to decompress it, I simply didn’t bother any further as I have no need to decompress such files myself.

  3. nin says:

    GHIDRA MENTIONED!!! i tried to do it myself before but i couldn’t understand anything. i’ll tell you if it works later. tysm!!!

  4. nin says:

    tried it but nothing happened – do i have to remove the jgf5 graphics and the image size data? tell me if you need the file itself tho.

  5. nin says:

    by jgf5 i meant the header

Leave a Reply