image always appears cut off
lucasromeiro opened this issue · comments
I use some images on my LCD, but I'm trying to convert a 13x13 pixel image to show in lcd as bitmap.
I do not know why, the image always appears cut off.
use:
ssd1306_drawBitmap (2, 40, 13, 13, exclamationNormal);
const uint8_t exclamationNormal [] PROGMEM = {
0x00, 0x00, 0xC0, 0x70, 0x1C, 0x06, 0xF3, 0x06, 0x1C, 0x70, 0xC0, 0x00, 0x00, 0x0C, 0x0F, 0x09,
0x08, 0x08, 0x08, 0x0A, 0x08,
};
last version
lcd ssd1306
last Arduino board and program
image: https://cdn.pbrd.co/images/HXaF5ZZ.bmp
Should I use canvas?????
Hello,
How did you get the image data? Which program did you use?
It looks like image data doesn't contain all pixels.
Hello,
How did you get the image data? Which program did you use?
It looks like image data doesn't contain all pixels.
Hello, I try:
LCDAssistant.exe
and
http://javl.github.io/image2cpp/
Can you try these data instead of yours:
// 'HXaF5ZZ', 13x13px
0xff, 0xff, 0x3f, 0x8f, 0xe3, 0xf9, 0x0c, 0xf9, 0xe3, 0x8f, 0x3f, 0xff, 0xff, 0x13, 0x10, 0x16
0x17, 0x17, 0x17, 0x15, 0x17, 0x17, 0x17, 0x16, 0x10, 0x13
Can you try these data instead of yours:
// 'HXaF5ZZ', 13x13px 0xff, 0xff, 0x3f, 0x8f, 0xe3, 0xf9, 0x0c, 0xf9, 0xe3, 0x8f, 0x3f, 0xff, 0xff, 0x13, 0x10, 0x16 0x17, 0x17, 0x17, 0x15, 0x17, 0x17, 0x17, 0x16, 0x10, 0x13
I had that for a comma after 0x16.
did not work.
The other tests were also cut off.
see: https://imgur.com/a/cwBJwVm
every time it's like this, with your code or mine. Cut 4 or 5 lines from the end. you can see?
I used this command:
ssd1306_drawBitmap (2, 40, 13, 13, exclamationNormal);
X and Y also did not fit correctly on the LCD. weird.
Please, read documentation carefully. The documentation to ssd1306_drawBitmap() says that height must be divided by 8 and y position is vertical position in blocks (pixels/8).
So, in your case the call should look like this:
ssd1306_drawBitmap (2, 5, 13, 16, exclamationNormal);
// where 5 = 40/8 and height is 16, since 16 can be divided by 8.
And still your data are incorrect, since they contain less than 26 bytes. If you use http://javl.github.io/image2cpp/, then please, choose Invert colors
option, and code output format Arduino
, and Draw mode Vertical
. After all that, you will get what you need:
// 'HXaF5ZZ', 13x13px
const unsigned char exclamationNormal [] PROGMEM = {
0x00, 0x00, 0xc0, 0x70, 0x1c, 0x06, 0xf3, 0x06, 0x1c, 0x70, 0xc0, 0x00, 0x00, 0x0c, 0x0f, 0x09,
0x08, 0x08, 0x08, 0x0a, 0x08, 0x08, 0x08, 0x09, 0x0f, 0x0c
};
void setup()
{
ssd1306_128x64_i2c_init();
ssd1306_clearScreen();
ssd1306_drawBitmap (2, 5, 13, 16, exclamationNormal);
}
Alternatively, you can you use gfx_drawMonoBitmap()
:
gfx_drawMonoBitmap(2, 40, 13, 16, exclamationNormal);
Great!
This was the problem!
Thanks for the orientations!