EleksTubeHAX
EleksTubeHAX copied to clipboard
1, 4, and 8 bit per pixel BMP support
This adds support for three BMP formats with 1, 4 and 8 bits per pixel. They use a color palette to determine the RGB888 color, each pixel only stores its palette index, which drastically reduces file sizes. These formats are standardized and can easily be generated with e.g. paint.net. Which one should be preferred depends on the clockface, for simple monochrome ones, the 1 BBP format is enough and needs only ~5% of the size of a 24BPP BMP file!
UNTESTED I've only verified this code as part of the WLED usermod and ported it over, please test before merging :)
Bits per pixel | File size in kB (for 135x240 img) | % of 24 BPP BMP | Max unique colors |
---|---|---|---|
24 | 98 | 100% | 16M (66K) |
16 (.clk) | 64.8 | 66% | 66K |
8 | 33.7 | 34% | 256 |
4 | 16.4 | 17% | 16 |
1 | 4.9 | 5% | 2 |
Comparison 1 vs. 4 vs. 8 vs. 24 BPP. With this clockface on the clock, 4 bit looks good, and 8 bit is almost indistinguishable from 24 bit.
Thank you for the warning about the lack of testing. I like this idea, but I'm not at a place where I can take the time to test before merging.
If anyone else can do that, I'll take your word for it and merge it. :-)