Tools for Windows bitmap (Windows V3 format) or any images by Python3.
日本語/Japanese
I will publish the scripts I needed to create my game on M5Stack.
Reorder and combine palette colors for 16 colors (4bit depth) bitmap.
- If not exists transpalent color RGB(255,0,255) then add to bitmap.
- Combine the same colors into one. If the result is less than 16 colors, it is padded.
- Sort palettes ascending by RGB, However the index of transparent color is fixed at 0
- Output bitmap that reordered palette colors applied.
python3 reorder_palette.py src_bitmap.bmp dest_bitmap.bmp
Output C style source to stdout in GFXfont, FixedBMPfont, and GLCDfont format.
(Only monospaced font.)
- You can specify image files supported by the Pillow.
- Load image and binarize.
- Crop to the size specified by the argument
- Output to stdout as if starting from the code specified by the argument.
- It can be displayed in LovyanGFX or any library that supports font output.
python3 make_lgfxbmpfont.py src_image_path -width 8 -height 8 --name example --code 32 > example_font.h
output example(--format GFX)
const uint8_t example_bitmaps[] PROGMEM = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ' '
0x1c,0x1c,0x1c,0x18,0x18,0x00,0x18,0x00, // '!'
0x36,0x36,0x24,0x00,0x00,0x00,0x00,0x00, // '"'
.
.
.
};
const GFXglyph example_glyphs[] PROGMEM = {
{ 0, 8, 8, 8, 0, -8 }, //' '
{ 8, 8, 8, 8, 0, -8 }, //'!'
{ 16, 8, 8, 8, 0, -8 }, //'"'
.
.
.
};
const GFXfont example_font PROGMEM = {
(uint8_t*)example_bitmaps, (GFXglyph*)example_glyphs, 0x20, 0x5f, 8 };
Windows bitmap accessor.
reorder_palette.py use the gob_bitmap.py.
If you want to convert format of images. see also ImageMagic