**** 珍贵资料为前人研究成果, 为后人路基之石. ****
An individual IMG file is a binary representation of raster map data used by Garmin GPS receivers and the MapSource map utility. It is a closed/proprietary format developed by Garmin.
The IMG format appears to be structured to optimize rendering speed of the GPS device first,and minimize file size second. This is consistent with the fact that GPS receivers generally have low-speed, low-power processors (compared to a personal computer) and therefore benefit from algorithms and data rganizations that minimize the work needed to draw the display.
The secondary concern, file size, stems from the limited memory present in most Garmin receivers compared to the sizes of the map files, themselves. The IMG file makes every effort possible to conserve bytes, something that is particularly evident in the section of the file that defines the “text labels” for map elements (streets, points of interest, etc.).
IMG files store words and dwords in a little endian byte order.
Before you can look at an IMG file, you must XOR it with the XOR byte (the first byte in the file). Some maps are not XOR’d (the first byte is 0x00).
ACb#DB4J @16151.1 File Overview
An IMG file can be thought of as having two parts: a header and a list of files. In this respect, it somewhat resembles a memory-mapped filesystem. In fact, some of the concepts of filesystems can be applied directly to the layout of the file, itself, as Garmin has adopted a few conventions from that arena.

100GPS-中国最大的GPS网|导航地图软件下载|报价|手机PDA车载蓝牙GPS;RZ.|#Zi @ oA4Tj
Of particular interest is what appears to be an actual partition table, recognizable as such by the inclusion of the bytes 0x55 0xAA at file offset 0x0F1E. This placement is obviously deliberate and corresponds to a DOS-style. primary disk partition which happens to consists of 512 bytes total, ending in 0x55 0xAA. In a true partition table, the first 446 bytes would be used to hold a boot loader program, but since the IMG file is data and not a program, those 446 bytes are used to store generic information, such as the map name and the date that it was created, as well as some specifics about the physical layout of the file itself.
di8\3K8rN4f1615The checksum at 0xF is calculated by summing all bytes, save for the checksum byte itself, in the map file and then multiplying by -1. The lowest byte in this product becomes the checksum byte at 0xF. Note that this checksum is apparently not validated by MapSource, since you can modify the contents of IMG files directly with a hex editor and they will still work even if the checksum100GPS-中国最大的GPS网|导航地图软件下载|报价|手机PDA车载蓝牙GPS4d4OA;ayU6up/F
is not updated.
Most notable are the two byte values (at 0x61 and 0x62, here named as E1 and E2) which are used to set the block size for the file. They represent powers of two, and the block size is set via the formula 2 1 2 E E + . E1 appears to always be 0x09, setting the minimum block size to 512 bytes.
100GPS-中国最大的GPS网|导航地图软件下载|报价|手机PDA车载蓝牙GPS]Q
fO1jMZ
Following the partition table is a pointer to the first sub-file in the IMG file, which represents the start of the data section. This offset is used to calculate the length of the FAT (described below).
Another interesting section is the block sequence counter that begins at offset 0x420. Each dword represents a block number in the file, starting at 0 (the 1st byte in the IMG file). This particular block sequence indicates which file blocks are taken up by the IMG file header, and the sequence is padded with 0xFFFF. So, if the sequence count looks like this:
100GPS-中国最大的GPS网|导航地图软件下载|报价|手机PDA车载蓝牙GPSf+P
n({va
0x0000 0x0001 0x0002 0x0003 0x0004 0x0005 0x0006 0xFFFF …
100GPS-中国最大的GPS网|导航地图软件下载|报价|手机PDA车载蓝牙GPS1?#jJWw2I8PEVy
Then we can conclude that the IMG file header consumes blocks zero through six. Combined with the block size as calculated from E1 and E2 we can determine the total number of bytes that the header consumes on disk (the actual header size will likely be less, and is padded to the block-boundary).
(待续 ......)