[Coco] Compressed pictures

Mark McDougall msmcdoug at iinet.net.au
Sat Apr 28 20:51:37 EDT 2007

Diego wrote:

> Some sample simple screens came down to just under 1 Kb (I know
> that some complex screens can become a lot larger than the original) My
> question: Is there some format/way to get a screen picture+loader in less
> than 2 Kb thatls already out there somewhere?

The algorithm you describe is called "Run Length Encoding" (RLE) and IIRC 
was used in early windows BMP formats. It's really only suitable for images 
with a low colour count, and most effective for cartoon-style/cell-shaded 
graphics rather than, say, dithered images.

Search for RLE and you should find some doco on it.

You should be able to code a loader in a few lines of basic - simply read 
the 1st byte of the file, decode it, and then read the next <n> bytes in a 
loop. Repeat until end-of-file.


|              Mark McDougall                | "Electrical Engineers do it
|  <http://members.iinet.net.au/~msmcdoug>   |   with less resistance!"

More information about the Coco mailing list