Converting bitmap to code
Converting bitmap to code
Conversion can be done in multiple ways, but we'll focus just on some of them.
These types of conversion are usually done by software, so we're going to do the same.
Software conversion
One of the programs that are rather simple, yet capable of doing this, is Image Converter 565.
You can download it from our website and when you open it, you'll get a screen like this.
The program itself is pretty simple - you upload the bitmap, convert it, and export the code!
You can also change the desired size if you want so.
The end product will look something like this.
All you need from this code is this constant called 'icon'. Just copy it inside your program and use it!
Another one of those programs is LCD image converter which does things pretty similarly and is equally easy to use.
Alternatively, if you're working with smaller images, you can just copy the color codes pixel-by-pixel inside of an array just like this one. Just remember to convert the color to RGB565 ( since the colors are usually in RGB888).