#### Archived

This topic is now archived and is closed to further replies.

# Compression Ratio Calculating (Is This Right?)

This topic is 5392 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I''ve been working on upgrading my resource creator for my new project and I was wondering if I''m calculating the ratio right? So far I''m using: Result = OriginalSize / CompressedSize Is it really as sinple as that? I''m not good with precentages so I can''t be sure. It seems as though the percentages should be a lot higher? Here''s how the percentages are coming out: 3072 / 320 = 9.6% Right? Thanks for the help. -UltimaX- Ariel Productions "You wished for a white christmas... Now go shovel your wishes!"

##### Share on other sites
Your 6th value down goes from 768 KB to 319 KB and you have a 2% ratio. But 319KB / 768 KB is 41%. So there is definitly something wrong with your percentages.

LinaInverse2010

##### Share on other sites
quote:
Original post by LinaInverse2010
Your 6th value down goes from 768 KB to 319 KB and you have a 2% ratio. But 319KB / 768 KB is 41%. So there is definitly something wrong with your percentages.

LinaInverse2010

So do I have it backwards?
Result = OriginalSize / CompressedSize

Do I need:
Result = (CompressedSize / OriginalSize) * 100

Thanks

-UltimaX-
Ariel Productions

"You wished for a white christmas... Now go shovel your wishes!"

##### Share on other sites
Yup, that should do the trick

---------
Life is like a grapefruit. It''s sort of orangy-yellow and dimpled on the outside, wet and squidgy in the middle. It''s got pips inside, too. Oh, and some people have half a one for breakfast

##### Share on other sites
Thanks everyone. (Love the quick responses )

-UltimaX-
Ariel Productions

"You wished for a white christmas... Now go shovel your wishes!"

##### Share on other sites
This looks much better:

Thanks agian,

-UltimaX-
Ariel Productions

"You wished for a white christmas... Now go shovel your wishes!"

##### Share on other sites
Still wrong. Should be:

Compression % = (original size / compressed size) * 100

3.0 MB -> 341.75 KB = 89.9% compression (90%)

Also, make sure you''re working in the same units (bytes). So, 3.0MB = 3.0 * 1024 * 1024 = 3145728 bytes, etc.

That oughtta do it!

Cheers!
Drew

##### Share on other sites
quote:
Original post by Anonymous Poster
Still wrong. Should be:

Compression % = (original size / compressed size) * 100

3.0 MB -> 341.75 KB = 89.9% compression (90%)

Also, make sure you''re working in the same units (bytes). So, 3.0MB = 3.0 * 1024 * 1024 = 3145728 bytes, etc.

That oughtta do it!

Cheers!
Drew

Thanks AP. I calculate them in the same units, it''s just when I display them that I change to the 3.0MB.

Thanks agian,

-UltimaX-
Ariel Productions

"You wished for a white christmas... Now go shovel your wishes!"

##### Share on other sites
AP, it come out wrong that way...
When I do it that way I get this:
(384.05KB / 40.85KB) * 100 = 940%

-UltimaX-
Ariel Productions

"You wished for a white christmas... Now go shovel your wishes!"

##### Share on other sites
quote:
Original post by UltimaX
AP, it come out wrong that way...
When I do it that way I get this:
(384.05KB / 40.85KB) * 100 = 940%

-UltimaX-
Ariel Productions

"You wished for a white christmas... Now go shovel your wishes!"

Thats right. It is nearly 10 times smaller.

"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"

1. 1
2. 2
3. 3
Rutin
20
4. 4
5. 5
khawk
14

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633655
• Total Posts
3013181
×