Member-only story
ARDUINO // IMAGE COMPRESSION
Image Compression Algorithm for the 4" TFT SPI ST7796S on an Arduino
Or… How to get the most out of the limited memory on Arduino devices for image display
27 min readJun 5, 2023
The c565 Image Format
Or the compressed rgb565 image format is a lossless format that reduces the memory footprint of an image, yet displays quickly and correctly.
None of the thinking behind this is new or revolutionary, and now there are two compression algorithms.
- Compressed — a simple format that has markers to indicate whether the following
uint16_t
's should be repeated, or just written raw.
Notes: If the MSB of the word is high, then it is a repeated pixel and the MSB &’ed with the word (i.eword & 0x8000
) is the number, if it is low, then it is just raw colours that follow. - Indexed — another simple format that utilises the same compression as the format above, except that they are all
uint8_t
8-bit markers and colours. The colours are then looked up in the header colour mapping for the 16-bit colour.
Notes: This is similar to a GIF/PNG format and is only available if there are less than 256 colours (as this is an 8-bit format).