Mono bitmap converter for tft

Hello,
Do you know of a converter that transforms images into mono c arrays(not in RGB565).
Which can be used with this:

tft.drawBitmap(96, 176, tractor_128x64, 128, 64, GREEN);

In the mcufriend draw bitmaps example, there are images of this type but I don't know how to create mine.

I searched the internet but couldn't find anything that worked.

Most images on the internet are JPEG or PNG.
Use IrfanView or GIMP to resize, reduce colours, rotate, clip, edit, ...

Save as a JPG
Use an online converter like http://www.rinkydinkelectronics.com/_t_doimageconverter_mono.php

There are several programs that will convert JPG to a mono bitmap
Some will do the resizing for you. Most will show you the finished bitmap.

However the results can look a bit blocky or uneven. Which is why it is wise to do your resizing and colour reduction in a PC application first.

David.

I took a black png image in size 64x64 and converted it to jpg.
But the tool returns a full square (only 0xFFs) even though it displays the normal visual.
I don't know what I'm doing wrong.
I think I am making a mistake but I do not know where.

I managed to get this with the Digole tool but it's reversed, I can change the black around the image but not the icon itself.

0xff,0xff,0xff,0xff,0xff,0xf1,0xff,0xff
,0xff,0xff,0xff,0xff,0xff,0xf0,0xff,0xff
,0xff,0xff,0xff,0xff,0xff,0xf0,0x7f,0xff
,0xff,0xff,0xff,0xff,0xff,0xf0,0x1f,0xff
,0xff,0xff,0xff,0xff,0xff,0xf0,0x1f,0xff
,0xff,0xff,0xff,0xff,0xff,0xf8,0x0f,0xe7
,0xff,0xff,0xff,0xff,0xff,0xf8,0x07,0x87
,0xff,0xff,0xff,0xff,0xff,0xf8,0x07,0x07
,0xff,0xff,0xff,0xff,0xff,0xf8,0x06,0x07
,0xff,0xff,0xff,0xff,0xff,0xfc,0x06,0x07
,0xff,0xff,0xff,0xff,0xff,0xfc,0x04,0x07
,0xff,0xff,0xff,0xff,0xff,0xfe,0x08,0x07
,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x07
,0xff,0xff,0xff,0xff,0xff,0x80,0x18,0x0f
,0xff,0xff,0xff,0xff,0xfe,0x00,0x00,0x0f
,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x0f
,0xff,0xff,0xff,0xff,0xff,0x80,0x00,0x1f
,0xff,0xff,0xff,0xff,0xff,0xe0,0x07,0x3c
,0xff,0xff,0xff,0xff,0xff,0xf0,0x07,0xe0
,0xff,0xff,0xff,0xff,0xff,0xfc,0x0f,0xc0
,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00
,0xff,0xff,0xff,0xff,0xff,0x00,0xfe,0x01
,0xff,0xff,0xff,0xff,0xff,0x80,0x1e,0x01
,0xff,0xff,0xff,0xff,0xff,0xc0,0x0c,0x01
,0xff,0xff,0xff,0xff,0xff,0xc0,0x04,0x03
,0xff,0xff,0xff,0xff,0xff,0xe0,0x04,0x03
,0xff,0xff,0xff,0xff,0xff,0x70,0x04,0x07
,0xff,0xff,0xff,0xff,0xff,0x18,0x06,0x0f
,0xff,0xff,0xff,0xff,0xff,0x04,0x0f,0xbf
,0xff,0xff,0xff,0xff,0xff,0x01,0x1f,0xff
,0xff,0xff,0xff,0xff,0xff,0x80,0xff,0xf1
,0xff,0xff,0xff,0xff,0xff,0x80,0x7e,0x01
,0xff,0xff,0xff,0xff,0xff,0x80,0x38,0x03
,0xff,0xff,0xff,0xff,0xf9,0xc0,0x20,0x03
,0xff,0xff,0xff,0xff,0xf8,0x40,0x20,0x07
,0xff,0xff,0xff,0xff,0xf8,0x20,0x20,0x0f
,0xff,0xff,0xff,0xff,0xf8,0x00,0x20,0x0f
,0xff,0xff,0xff,0xff,0x38,0x00,0x60,0x3f
,0xff,0xff,0xff,0xff,0x18,0x0f,0xf0,0x7f
,0xff,0xff,0xff,0xff,0x18,0x07,0xf9,0xff
,0xff,0xff,0xff,0xff,0x0c,0x03,0xff,0xff
,0xff,0xff,0xff,0xfe,0x04,0x03,0x87,0xff
,0xff,0xff,0xff,0xde,0x04,0x02,0x00,0x7f
,0xff,0xff,0xff,0x8e,0x02,0x00,0x00,0x1f
,0xff,0xff,0xff,0x8e,0x02,0x04,0x00,0x3f
,0xff,0xff,0xff,0x86,0x03,0x1c,0x00,0x7f
,0xff,0xff,0xff,0x06,0x01,0xfc,0x00,0xff
,0xff,0xff,0xff,0x02,0x01,0xfc,0x03,0xff
,0xff,0xff,0xff,0x02,0x01,0xfe,0x0f,0xff
,0xff,0xff,0xff,0x01,0x02,0x0f,0xff,0xff
,0xff,0xff,0xff,0x01,0x84,0x03,0xff,0xff
,0xff,0xff,0xff,0x01,0xfc,0x00,0xff,0xff
,0xff,0xff,0xff,0x01,0xfc,0x00,0x3f,0xff
,0xff,0xff,0xff,0x01,0xfc,0x00,0x1f,0xff
,0xff,0xff,0xff,0x01,0xfc,0x00,0x0f,0xff
,0xff,0xff,0xff,0x80,0x3c,0x00,0x7f,0xff
,0xff,0xff,0xff,0xf8,0x0f,0x07,0xff,0xff
,0xff,0xff,0xff,0x90,0x03,0xff,0xff,0xff
,0xff,0xff,0xfc,0x30,0x01,0xff,0xff,0xff
,0xff,0xff,0xc0,0xf0,0x00,0xff,0xff,0xff
,0xff,0xfc,0x03,0xf0,0x00,0x7f,0xff,0xff
,0x1f,0x00,0x0f,0xf8,0x00,0x3f,0xff,0xff
,0x00,0x00,0xff,0xfe,0x00,0x7f,0xff,0xff
,0x00,0x0f,0xff,0xff,0xff,0xff,0xff,0xff
tft.drawBitmap(96, 176, tractor_128x64, 128, 64, GREEN);

Look at the other examples. You can use different colours for foreground and background e.g.

tft.drawBitmap(96, 176, tractor_128x64, 128, 64, GREEN, BLACK);
tft.drawBitmap(96, 176, tractor_128x64, 128, 64, GREEN, WHITE);
tft.drawBitmap(96, 176, tractor_128x64, 128, 64, BLACK, GREEN);

But you can probably ask the Digole utility to invert the colours.

Remember that this is a mono bitmap. You can choose whatever colour you want to paint for bit=1 and whatever colour for bit=0.

David.

1 Like

thanks a lot for your help

It works the way I want it to, perfect.

Where can you find the complete documentation for this library?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.