IMG (file format)
IMG, in computing, refers to binary files with the .img
filename extension that store raw disk images of floppy disks, hard drives, and optical discs or a vector image – .img
.
Overview
The .img
filename extension is used by disk image files, which contain raw dumps of a magnetic disk or of an optical disc. Since a raw image consists of a sector-by-sector binary copy of the source medium, the actual format of the file contents will depend on the file system of the disk from which the image was created (such as a version of FAT). Raw disk images of optical media (such as CDs and DVDs) contain a raw image of all the tracks in a disc (which can include audio, data and video tracks). In the case of CD-ROMs and DVDs, these images usually include not only the data from each sector, but the control headers and error correction fields for each sector as well.
Since IMG files hold no additional data beyond the disk contents, these files can only be automatically handled by programs that can detect their file systems. For instance, a typical raw disk image of a floppy disk begins with a FAT boot sector, which can be used to identify its file system. Disc images of optical media are usually accompanied by a descriptor file which describes the layout of the disc, and includes information such as track limits which are not stored in the raw image file.
Filename extensions and variants
The .img
file extension was originally used for floppy disk raw disk images only. A similar file extension, .ima
, is also used to refer to floppy disk image files by some programs. A variant of IMG, called IMZ, consists of a gzipped version of a raw floppy disk image. These files use the .imz
file extension, and are commonly found in compressed images of floppy disks created by WinImage.
QEMU uses the .img
file extension for raw images of hard drive disks, calling the format simply "raw".
CloneCD stores optical disc images in .img
files and generates additional CloneCD Control Files (with .ccd
extension) for each image to hold the necessary metadata. The CUE/BIN format stores disc images in .bin
files, which are functionally equivalent to .img
image files, and uses .cue
files as descriptor files.
Size
The file size of a raw disk image is always a multiple of the sector size. For floppy disks and hard drives this size is typically 512 bytes (but other sizes such as 128 and 1024 exist). More precisely, the file size of a raw disk image of a magnetic disk corresponds to:
- Cylinders × Heads × (Sectors per track) × (Sector size)
E.g. for 80 cylinders (tracks) and 2 heads (sides) with 18 sectors per track:
- 80 × 2 × 18 × 512 = 1,474,560 bytes or 1440 KB
For optical discs such as CDs and DVDs, the raw sector size is usually 2,352, making the size of a raw disc image a multiple of this value.
Comparison to ISO images
ISO images are another type of optical disc image files, which commonly use the .iso
file extension, but sometimes use the .img
file extension as well. They are similar to the raw optical disc images, but contain only one track with computer data obtained from an optical disc. They cannot contain multiple tracks, nor audio or video tracks. They also do not contain the control headers and error correction fields of CD-ROM or DVD sectors that raw disc images usually store. Their internal format follows the structure of an optical disc file system, commonly ISO 9660 (for CDs) or UDF (for DVDs). The CUE/BIN and CCD/IMG formats, which usually contain raw disc images, can also store ISO images instead.
IMG as an Image file format
Also, .img
is a vector graphics file, similar to Computer Graphics Metafile – .cgm
, and originated on the Atari ST home computers using a version of GEM operating systems. This file format was used on the Corel Ventura desktop publishing with the GEM Desktop operating systems.
Other disk image files
In addition, .img
is an Apple Disk Image used by the Mac OS X or macOS operating system.
Garmin .img is a hard-disk image file format which contains a header and many subfiles and using to store the maps for its GPS units.
Tools
The raw IMG file format is used by several tools:
- RaWrite and WinImage use the IMG disk image format to read and write floppy disk images.
- ImDisk and Virtual Floppy Drive can mount a raw image of a floppy disk to emulate a floppy drive under Microsoft Windows.
- Nero Burning ROM supports reading IMG files for creating bootable CDs.
- mtools allows manipulation of MS-DOS floppy disk images in Unix systems.
- Programs such as dsktrans from the LibDsk[1] suite of command-line tools (available for Linux, MS-DOS, and Microsoft Windows) will convert between different raw disk image formats.
- dd can be used in Unix to create raw disk image files of disks.
- QEMU uses IMG files as its default format for hard drive disk images.
- IrfanView with the plugin "FORMATS" (formats.dll) supports viewing GEM vector graphics IMG.
- Garmin MapSource or GPSMapEdit can be used to read Garmin hard-disk image
.img
format.