imagekotlinbinarypngraw

Image to indexed binary


I need to convert an image to binary. The result should be a 256 indexed binary file with the color format RGB565 16bit(1 color 2 bytes)

This format is used to store image background for watchfaces on cheap smartwaches.

https://github.com/fbiego/dt78/blob/master/firmware/watchface.md#decoded

https://lvgl.io/tools/imageconverter

This tool can create and indexed binary files but the format is RGBA 32bit (4 bytes per color) and also pads extra bytes at the start of the file.

What algorithm is used to create an indexed binary from an image?

Are there any Kotlin frameworks that can do this?


Solution

  • You will need to use a quantization algorithm of you choice, the algorithms include but not limited to;

    Check out this tool based on Median Cut algorithm developed using Kotlin Paletti