Run-length encoding for graphics files

Discuss game and other programming topics not specifically covered in another forum

Moderator: Programming Moderators

Post Reply
User avatar
Posts: 59
Joined: Tue May 30, 2017 2:56 am

Run-length encoding for graphics files

Post by Pgartside » Fri Jun 08, 2018 11:30 am

If you want to compress your graphics files for loading from sd card on the Next I have a little app to run-length encode them.
It compresses all the 0xe3, the transparent areas of the graphics.

To uncompress the graphics:

If byte=0xe3 the next byte is the length-1 so 0=1 and 255=256 so fill memory with 0xe3 for length+1
If byte!=0xe3 just copy the byte to memory

Some of my test on my graphics got me a %50 saving on card space.

It's written in C# and I've included the .exe for windows users and include the .cs so people can compile it for other platforms.
(3.57 KiB) Downloaded 57 times

Post Reply