IMG (file format)

An IMG file, a.k.a. raw image, contains a complete and uncompressed image of a storage device's data content. The image includes the value of each memory location of the storage device, ordered sequentially such that the data can be written to a similar device to completely overwrite its content.
The layout of data in a raw image depends on the file system of the target storage device (for example FAT). For example, an optical disc (i.e. CD or DVD) raw image contains the tracks of audio or video. In the case of a CD-ROM or DVD, an image usually includes not only the data of each sector, but the control headers and error correction fields for each sector as well.
Since raw image files hold no additional data, metadata, beyond the storage content, determining the structure of an existing image can be difficult. Either a user remembers what a file contains via their memory or records metadata in the file name or via some other mechanism. In some cases, a tool can detect aspects of an image file's content. For example, a typical floppy disk raw image begins with a FAT boot sector, which can be used to identify the file system. A raw optical disc image is usually accompanied by a separate file which describes the layout of the image data; including information such as track limits which are not in the raw image.
Raw disk image files sometimes have the filename extension .img, but the extension is used for other file formats and often other extensions are used for a raw disk image file.
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 raw image, 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 a raw image of a hard disk drive and calls the format "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.
The extension .img is also used for (unrelated) planar graphics files, originating with Digital Research's GEM. It was commonly used on the Atari ST line of home computers, but also with some GEM-based PC software such as Corel Ventura or Timeworks Publisher.
An Apple Disk Image file name may include the .img extension.
Garmin .img is a hard-disk image file format which contains a header and many subfiles and used to store the maps for its GPS units.
For devices with sectors, the size of a raw disk image is 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:
E.g. for 80 cylinders (tracks) and 2 heads (sides) with 18 sectors per track:
For an optical disc such as a CD or DVD, the raw sector size is usually 2,352, making the size of a raw disc image a multiple of this value.
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.
The raw image file format is used by several tools: