RLE Compression

Blitz3D Forums/Blitz3D Userlibs/RLE Compression

Nexinarus(Posted 2015) [#1]
here is my attempt at RLE Compression for 24-Bit BMPs.

It converts the RGB Values to a single integer.
First each value R,G, & B get converted to Multiples of 8 (0,8,16,24,etc...) then combined into an integer 0-32767
(this reduces the quality i know. But i still think it looks good.

Integers 32768-65535 are the counters.

Note:32768=3 65535=32770
The reason is that when saving only 2 identical colors side by side it is still 2 integers.

And in some cases, the file will not be compressed depending on the order of the colors.

I know it is 2 bytes per integer. But when comparing the final result to the 24-bit BMP Image, its 2 bytes per pixel instead of 3.

I dunno if this is useful at all. Probably not. I just wanted to see if i could do it.

it is on the following link in the code archeives. It is with this particular code arc thread because it is yet another RLE Compression.

http://www.blitzbasic.com/codearcs/codearcs.php?code=556






just input your inputfilename$ and outputfilename$.


-------------------------


Sorry that this is in the Userlibs section. I thought I clicked the programming section. I did not realize that i was In the Userlib thread until I posted this. Sorry about that. If the Admin can remove this thread. Please do so. I am going to put it in the programming section where i meant to put it all along.