IMG (DOSIMG)

From Just Solve the File Format Problem
Jump to: navigation, search
File Format
Name IMG (DOSIMG)
Ontology
Extension(s) .img

Overview

IMG is an RLE-compressed sector-based disk image format probably used by the DOS program HD-Copy and/or others. It should not be confused with raw image files (sector dumps).

There is a Pascal program floating around the internet which includes source code and can convert these IMG files to raw sector dumps. It is called DOSIMG and can be found mainly on various Chinese websites[1][2][3]

[Ed. note: This article needs a better title. We've named it "IMG (DOSIMG)" because the only thing we know for sure about this format is that it is supported by the DOSIMG utility.]

Format description

byte description
0 last track on the original disk (either 39 or 79)
1 number of sectors per track
2-166 one byte for each track, 0x01 if the track is included in the file, 0x00 otherwise (empty/unformatted)
For each track:
2 bytes compressed size of this track, little-endian, not including this size field but including the next byte
1 byte the escape-byte for the RLE coding
n-1 bytes The actual sector data, RLE compressed. Should uncompress to at most num_sectors * 512 bytes, rest is filled with zero.

Each byte is copied 1:1 to the output buffer, except when the escape-byte is encountered. Then, the next 2 bytes specify a byte-value and a count-value. To uncompress, copy the first byte after the escape-byte as many times as the second byte implies to the output buffer.

References

  1. http://download.pchome.net/system/disk/down-13054-1.html
  2. http://roy.orz.hm/soft/DOSIMG.zip
  3. https://bitbucket.org/snippets/tifan/EeLAay/python-script-to-extract-compressed-img
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox