Gzip compression ratio of an ASCII file

asciicompressiongzipimage-compression

So I have a remote sensing image in an ASCII format packed as *.gz

Packed file has 7.46 MB
Unpacked file has 635 MB

What is the reason for that? Is it a matter of gzip compression method or a structure of an ASCII file?

Best Answer

There are three factors:

  1. Fundamentally, the image is highly structured. It requires much less information to exactly replicate than a random image would.
  2. Representing arbitrary binary data using ASCII characters always takes extra space, and this format is much less efficient than something like https://en.wikipedia.org/wiki/Base64.
  3. The DEFLATE algorithm in https://en.wikipedia.org/wiki/Gzip is pretty good.