# IMG

From Just Solve the File Format Problem

File Format
Name | IMG
Ontology | Electronic File Formats Disk Image Formats IMG
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]

## 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

Retrieved from "http://fileformats.archiveteam.org/index.php?title=IMG&oldid=16715"
Categories:

- File Formats
- Electronic File Formats
- Disk Image Formats
- File formats with extension .img

Hidden category:

- FormatInfo without mimetypes

##### Personal tools

- Log in / create account

##### Toolbox

- What links here
- Related changes
- Special pages
- Printable version
- Permanent link