I just released to the public the implementation of PackBits that I use. See my Fork of taller2
When loading many images one can get to face the limitation of resources size. On pebble time a support for png was added. However, in SDK2 using two color images there is no such option.
Now that I'm making a new application like Finally but with different watchfaces, I was consuming the resources too fast. Images for numbers, backgrounds images, icons etc, all consume space for resources for their uncompressed size plus extra for 4 byte alignment. for example one bitmap of day "Wednesday", rotated 90 degrees takes 8 bit width, and 150 lines height. Yet, instead of 150 bytes, it will use 600 bytes. (each line is padded to 32 bit width).
My friend @MatthewClark
(Set Pebble) gave me his implementation of the classic PackBits, This simple RLE compression originated from Apple in early 80's was exactly right for me. The code uses under 300bytes of code memory
on the watch, It reduces all the padding space and even compresses a bit, and sometimes even allot. in the example of Taller2 that have many thin images and fonts, the compression is to less than 40% of original size
. In case of common watchface background images the full size of 3360 bytes (20*168) becomes 1536, 1091, 752, 1651
I fixed it a bit, and made it simple to use. One needs only to include this library and use gbitmap_create_from_pbt()
in same way that gbitmap_create_with_resource() is used. Compression is done by PHP script that works on all files in the folder.
It seem to be working reliably and I consider to improve it a bit more.
you are welcome to review the Github link above. The relevant information and instructions are there in the readme file.
I hope some of the developers will find it useful, please feel free to tell us about it.