In SeeedTFTv2/examples/tftbmp/tftbmp.ino the bmpdraw routine fails to handle BMP images correctly.
Adafruit’s routine had the same problem but they fixed it:
github.com/adafruit/Adafruit-ST … y/issues/6
Add this to ftftbitmap.ino as a global:
uint32_t rowSize; // Not always = bmpWidth; may have padding
add this at the top of bmpdraw:
uint32_t pos = 0;
Then here in , this code from Adafruit for reading from the beginning of the row:
for (i=0; i< bmpHeight; i++)
{
+ pos = bmpImageoffset + (bmpHeight - 1 - i) * rowSize;
+ if(f.position() != pos) {
+ f.seek(pos);
+ buffidx = sizeof(sdbuffer);
+ }
for (j=0; j<bmpWidth; j++)
{
Then here in bmpreadheader:
bmpHeight = read32(f);
+ // BMP rows are padded (if needed) to 4-byte boundary
+ rowSize = (bmpWidth * 3 + 3) & ~3;
The Adafruit version also reads a header to determine whether to flip or not, to handle the rare case of non-flipped BMP files.