Arduboy2/extras/cabi
Scott Allen 966c2125f1 Add the Team A.R.G. cabi program to extras
cabi is a command line program written in C. Its purpose is to read
a PNG file containing a bitmap image and convert it to C/C++ code
suitable for use with the drawCompressed() function.

cabi was published by the Team A.R.G. organization. This organization
has been dissolved and its presence on the internet has been removed,
thus public access to cabi from them is no longer available.

A copy of the relevant cabi files has been added under the extras
directory to maintain a method of creating drawCompressed() compatible
bitmaps.
2020-07-24 17:15:37 -04:00
..
LICENSE Add the Team A.R.G. cabi program to extras 2020-07-24 17:15:37 -04:00
README.md Add the Team A.R.G. cabi program to extras 2020-07-24 17:15:37 -04:00
cabi.c Add the Team A.R.G. cabi program to extras 2020-07-24 17:15:37 -04:00

README.md

Cabi

Arduboy encoder: Monochrome rle encoding by Zep @lexaloffle

This tool is used for creating a compressed array from an image (png)

The function to decompress in Arduino (Arduboy) can be found here:

https://github.com/TEAMarg/drawCompressed

to build:

gcc cabi.c lodepng.c -o cabi

to use:

cabi input_file.png [array_name_prefix]

Look at the compress ratio, before using the compressed data, it might be worse in some cases (above 1 is bad)

ouput:

// input_file.png  width: 128 height: 48
const uint8_t PROGMEM array_name_prefix[] = {
  0x7f,0x2f,0x30,0x68,0xb7,0xdb,0xed,0xdb,0x53,0x9f,0xfa,0x73,0x97,0xbb,0xd5,0xe7,
  0x2e,0x77,0xb9,0xcb,0x5d,0x6e,0xbb,0xbd,0xdc,0xe5,0x2e,0x77,0xb9,0xcb,0x5d,0xee,
  0x72,0x97,0x5b,0x2b,0xbb,0xdc,0x6e,0xb7,0xdb,0xed,0x76,0xbb,0xdd,0x6e,0xb7,0xdb,
  0xed,0x76,0xbb,0xdd,0x6e,0xb7,0xca,0xae,0x43,0x57,0x76,0xbb,0x5d,0x6e,0xb7,0xdb,
  0xed,0x76,0xbb,0xdd,0x6e,0xb7,0xdb,0xad,0xb2,0xdb,0x75,0xd8,0x5a,0x2a,0xb9,0xdd,
  0x6e,0xb7,0xeb,0x75,0x74,0xd9,0xe5,0x72,0xf9,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xda,0x39,0xbb,0xba,0xb7,0x53,
  0x25,0x95,0xdc,0x2e,0x95,0x53,0xf6,0x72,0x97,0x93,0x4a,0x3a,0xa9,0xa4,0x3a,0xa5,
  0x7a,0x95,0xfa,0x5c,0xa7,0xd3,0x69,0xae,0xed,0x2a,0xa9,0x64,0x25,0x95,0x4e,0xa7,
  0xd3,0xe9,0xd0,0x97,0x5e,0x67,0xb7,0xa1,0x69,0x9d,0x1d,0xcb,0xe9,0xed,0x36,0x34,
  0xea,0x74,0x3a,0x9d,0x56,0x4a,0x2a,0xa9,0x94,0x4e,0xa7,0x53,0x44,0x4a,0x56,0xa9,
  0xaa,0x54,0x2a,0x25,0x75,0x5a,0x6d,0x95,0x74,0xeb,0x74,0xe7,0x8a,0x4a,0xc9,0x2a,
  0x55,0x95,0x4a,0xa5,0xa4,0x56,0xd2,0x39,0xe7,0xb6,0xdb,0xed,0xf6,0xed,0x29,0x59,
  0xc9,0x4a,0x2a,0xe2,0x74,0xb4,0xe9,0xd0,0xb5,0xce,0x8e,0xfd,0x74,0x3a,0xb4,0x01
};
// bytes:640 ratio: 0.833


const uint8_t PROGMEM array_name_prefix_mask[] = {
  0x7f,0x2f,0x81,0xff,0x17
};
// bytes:5 ratio: 0.007