From Just Solve the File Format Problem
The G64 file format was intended to solve the difficulties with the "standard" Commodore 64 D64 disk images, namely that they could not contain some of the more elaborate copy protection schemes from the late eighties and early nineties. Instead of storing the disk sector by sector, the G64 format stores the "raw" GCR encoded data that the drive reads from the disk. In doing so, it was able to correctly image many protection schemes that relied on "long tracks", non-standard sector sizes or even non-standard densities on the disk.
- G64 documentation from the VICE emulator here
- G64 reference doc by Markus Brenner here
- G64 specs from 
- Documentation with some code snippets here