New library - RLE (run length encoded) Bitmaps, with image sets.

I have created a new library for rendering RLE (run length encoded) bitmaps on any Adafruit GFX compatible display. It is available form the Library Manager as ‘RLEBitmap’. The bitmaps are stored as data in your program, not as files.

RLE is a very simple compression method that works well on images with few colors and large regions of colors - for example, many icons.

I have included with the library an icon set for showing weather conditions or forecasts, and a second set for displaying phases of the moon.

The weather set has 20 day and 20 night icons, although many of the night icons are the same as the day ones. The duplicates are provided for convenience / completeness, but in practice there is no need to use them. Here’s ‘mostlyclear’:

Each weather image is about 900 bytes.

The weather icons are based on a set originally designed by Ashley Jager. They are sized at 128x128, and the API can render them smaller by dividing by any integer amount.

The moon image is from NASA. Here is the 128x128 version:

Each version also comes with a set of 32 masks to show the phases of the moon. The entire set is provided in several different sizes to suit your requirements.

Since the moon has much more variation, it does not compress as well. The 128x128 version uses about 8400 bytes. 64x64 is still quite recognizable, and uses about 2400 bytes:

Finally, there is source code for a Windows program to convert a bitmap (.BMP file) to this encoding, used for all the images here.

Hi MHotchin, where can I download the library to start running tests on several OLEDs ?

regards, Photoncatcher

It's available in the Library Manager as 'RLEBitmap', or you can get it directly from GitHub here:

If you have any questions, you can contact me through GitHub, or create a new Issue.

The library works very well. Good stuff.

For TFT_eSPI library users I have created a compatible fork here and adapted it slightly. The example should run without modification on your current working setup.

Note that the example and library have been tweaked so I can produce a Moon phase animation without flicker, so there is an incompatibility of the masking function when compared with Mhotchin's original library.

I have not tried to use the weather icons yet.

bodmer:
For TFT_eSPI library users I have created a compatible fork here

It looks like in your fork you could remove the startWrite() and endWrite() calls, since drawFastHLine() already manages the SPI context.

MHotchin:
It looks like in your fork you could remove the startWrite() and endWrite() calls, since drawFastHLine() already manages the SPI context.

I understand the reasoning, but rendering performance would suffer. The TFT_eSPI library manages the SPI transaction and chip select with a flag which is tested each time a rendering function is entered to see if the SPI bus is already owned. startWrite() grabs the SPI bus and sets that flag.

The Adafruit library uses a different approach, ie two functions, in this case drawFastHLine which manages the transaction and calls writeFastHLine.

I like your library. Some time ago I did consider implementing a TGA/TARGA image rendering library as that format uses RLE but never got much further than looking at available code.

Sorry for my ignorance, will this make a series of images draw in sequence and appear like a movie? If so, I am using an Uno with a 2.8" TFT Shield with a MicroSD slot and want to load images to the SD. Will this work for that?

captry:
Sorry for my ignorance, will this make a series of images draw in sequence and appear like a movie? If so, I am using an Uno with a 2.8" TFT Shield with a MicroSD slot and want to load images to the SD. Will this work for that?

Not really, like the other bitmap drawing functions it just draws a picture, albeit one that is stored differently. To make an animation, you just render picture after picture.

These functions are intended for images that are stored in PROGMEM, rather than SD card.

I have updated to version 1.1.0. The RLE library now directly supports the TFT_eSPI library as well as the Adafruit_GFX library.