Determining File Compression Ratio
Date: 04/11/2001 at 09:24:59 From: Nusen Tsung Subject: Determining File Compression Ratio Hi Dr.Math, I am having a problem. The answer is on the tip of my noodle, but I'm having total mind clog. If you have a file A whose size is x bytes in size, and you compress it into a file we'll call B whose size in bytes is now y, what is the equation to find the compression ratio, disgregarding the time it took to compress? I can find the percentage that the file was compressed, but I can't remember how to figure out the ratio. Thank you for all your help in the past. Dr. Math rules! Sincerely, Nusen
Date: 04/11/2001 at 13:09:23 From: Doctor Twe Subject: Re: Determining File Compression Ratio Hi Nusen - thanks for writing to Dr. Math. A ratio is simply a comparison of two numbers. The file compression ratio, then, would be expressed as x:y. Usually, the latter value is reduced to 1. To do that, we divide both numbers by y, so the ratio is then expressed as (x/y):1. This is really the same ratio, but it is easier to compare two ratios if they both use the same basis. For example, if an 875 kB file is compressed to 25 kB, then the compression ratio is: r = (875 k): (25 k) = 35:1 A word of caution: be sure that the units are the same in both parts. Suppose, for example, a 2.25 MB file is compressed to 384 kB. Since one is measured in megabytes and the other in kilobytes, we have to find a common unit. There are 1024 kilobytes in one megabyte, so I'll convert the 2.25 MB to kB: 2.25 MB * 1024 kB/MB = 2304 kB Now I can compute the compression ratio: r = (2304 kB):(384 kB) = 6:1 I hope this helps. If you have any more questions, write back. - Doctor TWE, The Math Forum http://mathforum.org/dr.math/
Search the Dr. Math Library:
Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.