File Compression Theory

By: W-Buffer

* You ever asked yourself, why a BMP that is in blank eats 1Mb of my HD?
- OK this is simple, all is cuz the file isn't compressed, here is the compression theory so you can compress a BMP from 1Mb to 20 kb:

Every file, including EXEs are only 0101010101010101, but VB open files in binary mode geting the file in Bytes, this mean that the file are maded from Bytes (0 to 255), some times the same Byte Repits 3000 times!, to solve this space problem programmers maked a stardar to compress files:

Whe you find: 12,12,12,12,12,12,12
You can compress it like this: X,12,#,7

Here the key: "X" with this character will init the compression sequence, after that it goes the character that you funded, then a "#" the indicates that the next number is the times that the caracter repits, and at last the times that the caracter repits.

Here a example:

Original (ASCII): BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
Compressed (ASCII): XB#40
Compressed (Binary): 88,66,35,40

OK thats all, how implement it is your problem, till i write a tutorial for that :)

Later!

Hosted by www.Geocities.ws

1