The Satellite Imagery Source

Search Image Hunter Now
Posted on January 10th, 2013

G-FAQ – What is the Best Compression Format for TIFFs?

For this month’s Geospatial Frequently Asked Question (G-FAQ), I explore a topic that perhaps some of us have given little consideration to: file compression. Specifically, I look at file compression of TIFFs which are commonly large datasets that we have to store for both short and long time periods. Take for instance the minimum order of 25 square kilometers (sq km) of 50-centimeter (cm) WorldView-2 imagery with 8-bit depth, this dataset alone is 400 megabytes (mb). Now consider the enormity of a 1-foot aerial collection over an entire county, and surely the topic of file compression now makes a bit more sense. I have compressed my archival copies of client orders for some time now to reduce the amount of hard drive space needed for long-term storage; and thus, to save a bit of money.

With this in mind, the January G-FAQ will address this core set of questions:

  1. What is the best compression format for TIFFs?
  2. What freeware applications are offered for file compression?
  3. Is there a format that is better for short versus long-term storage?

In past G-FAQs, I have spent some time introducing the principles behind the topics discussed; this month, however, I will leave the principles of file compression to the experts – if you want to read more about the topic, check out this through summary. Suffice it to say that compression saves space by looking for repeating patterns in words, numbers and images; and then by replacing them with shorter data strings in the compressed file. Some compressed file formats you might be familiar with are .bin (Mac only), .gz, .rar, .tar (does not actually compress, it just bundles multiple files together into one) and .zip – with .zip far and away the most commonly used.

Freeware File Compression Software

While there are a plethora of freeware programs that can create compressed files, here is a list of some good options:

But my favorite freeware program is 7-Zip which is also featured in this month’s Free For All. You can read more about 7-Zip’s features here. On the 7-Zip website, they show test results where .7z appears to be the best format for file compression, and that is part of the inspiration for this G-FAQ.

The compression tests that you see below were completed on a Sony Vaio Laptop with 12 gb of RAM, a 64-bit Windows 7 Professional operating system and an Intel Core i7-3520M CPU running at 2.90 Ghz. During the tests, my laptop was plugged in and all programs were shut down except for those that normally run in the background such as anti-virus software and NVIDIA settings. The TIFF file used for the tests was a 16-bit depth 50-cm natural color image collected by WorldView-2 and covering 5 sq km. The file’s original size was 122,611,083 kb and I had 7-Zip version 9.20 installed for the tests.

In 7-Zip, you have the ability to tweak a variety of options when you create a compressed file. Here is a short summary of each:

  • Archive Format: this is the type of compressed file you will create, for example .7z or .zip
  • Compression Level: this sets the compression method from the fastest to ultra
  • Compression Method: specifies the algorithm used to compress your data
  • Dictionary Size: a larger dictionary usually increases compression ratios but makes the process slower
  • Word Size: specifies the length of words used to try and identify patterns in the compression process, a larger word size usually increases compression ratios
  • Solid Block Size: only valid for .7z format, a solid block usually increases compression ratios
  • Number of CPU Threads: specifies the number of computing requests to send to your processor at once, more threads usually means faster compression and more memory use

TIFF File Compression Results and Conclusions

I tweaked these options and tested 12 different combinations to get a sense of the best performing compression format. The results of these tests are presented in the chart below.

Before I present you with my conclusions following from the compression tests, let me explain the meaning of each column (or variable) in the chart above:

  • Compression Specs: this details the compression options used in each test, i.e. archive format, compression level, compression method, dictionary size, word size, solid block size and number of CPU threads; the baseline compression method is a .zip file with the default options in 7-Zip
  • Memory Used: the amount of RAM used to compress the TIFF file, in megabytes (mb)
  • Compress Size: the final size of the compressed file, in kilobytes (kb)
  • % Original: calculated as, (Compressed File Size) / (Original File Size)
  • % Baseline: calculated as, (Compressed File Size) / (Baseline Compressed File Size)
  • Compress Time: time to compress the TIFF file, in seconds (s)
  • % Baseline Time: calculated as, (Time to Compress) / (Time to Compress Baseline)
  • Addl Time: additional time calculated as, (Time to Compress Baseline) – (Time to Compress), in seconds (s)
  • Addl Compress: additional compression calculated as, (Baseline Compressed File Size) – (Compressed File Size), in kilobytes (kb)
  • Compress / S: compression per second calculated as, (Compress Size) / (Compress Time), in kilobytes (kb)
  • Addl Compress / Addl S: additional compression per additional second of compression time versus baseline calculated as, (Addl Compress) / (Addl Time), in kilobytes (kb); N/A means that this calculation was not possible for a given entry

Now that I have explained the variables used in this chart, let’s turn our attention to some conclusions that can be drawn from this data.

Best choice for long-term compression

  • When you are storing data for a long time, the compression ratio is usually the most important consideration as smaller files mean less storage space, and then less money spent on storage.
  • As such, the clear winner for long-term compression is .7z format using the ultra LZMA compression method. Increasing word, dictionary and block size will also increase compression ratios.
  • Increased compression comes with the drawback of extra time to compress and uncompress files.

Best choice for short-term compression

  • For short-term compression, the file size is important but then so is the speed to compress as you will not keep the data around for the long haul.
  • The best balance between speed and compression ratio is achieved by using .7z format with LZMA compression, a 64kb dictionary, an 8 word size and a non-solid block. – This option created files that were 15% smaller than the baseline ZIP while only taking 3 additional seconds to compress.
  • One drawback is that .7z format is not recognized by all software if you plan to share the compressed data. That said, 7-Zip is a freeware program so perhaps that is not a big issue!

Additional conclusions

  • The .gzip format yielded the worst (lowest) compression ratios.
  • The traditional .zip format was surprisingly robust in these tests as even the most compressed file was only about 20% smaller than the baseline.
  • The most important influence on compression ratio was not the file format but rather the compression method. LZMA is by far the best performer, saving an additional 7 to 10% for each compression format.

Until our next edition of G-FAQ, happy GIS-ing!

Do you have an idea for a future G-FAQ? If so, let me know by email at brock@apollomapping.com.

Find Out More About This Topic Here:

Brock Adam McCarty
Map Wizard
(720) 470-7988
brock@apollomapping.com

This entry was posted in The Geospatial Times and tagged , , , , , , Bookmark the permalink.

One Response to G-FAQ – What is the Best Compression Format for TIFFs?

  1. Santosa Sandy says:

    Awesome result

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

    The Geospatial Times Archive