Problems with Bitmaps on TFT Display using GFX Library

I attempted to draw a mono bitmap from the single example on your website. As it stands, the C file is attempting to store the data in SRAM. A Uno does not have enough SRAM.

I edited the butterfly2.c file to declare the tImage and to place the data in PROGMEM:

/*******************************************************************************
* image
* filename: /home/vladimir/workspace/lcd-image-converter-wiki/examples/image-butterfly2.xml
* name: butterfly2
*
* preset name: Monochrome
* data block size: 8 bit(s), uint8_t
* RLE compression enabled: no
* conversion type: Monochrome, Diffuse Dither 128
* bits per pixel: 1
*
* preprocess:
*  main scan direction: top to bottom
*  line scan direction: backward
*  inverse: no
*******************************************************************************/

#include <stdint.h>
#include <avr/pgmspace.h>

 typedef struct {
     const uint8_t *data;
     uint16_t width;
     uint16_t height;
 } tImage;



static const uint8_t PROGMEM image_data_butterfly2[9600] = {
...
};
const tImage butterfly2 = { image_data_butterfly2, 320, 240};

and displayed on a TFT with:

#include "MCUFRIEND_kbv.h"
MCUFRIEND_kbv tft;

typedef struct {
    const uint8_t *data;
    uint16_t width;
    uint16_t height;
} tImage;

extern const tImage butterfly2;

void setup()
{
    uint16_t ID = tft.readID();
    tft.begin(ID);
    tft.setRotation(1);
}

void loop(void)
{
    tft.fillScreen(TFT_BLACK);
    tft.drawBitmap(0, 0, butterfly2.data, butterfly2.width, butterfly2.height, TFT_BLUE);
    delay(5000);
}

The butterfly does not look very good in mono but it does get displayed.
There does not seem to be any way to load a JPG, PNG, BMP, ... from my PC and convert to the C array.

There are online programs e.g. http://skaarhoj.com/FreeStuff/GraphicDisplayImageConverter.php that can create a suitable array from a regular JPG on the PC (resizing if necessary).

Oh, you can store the data in a C file if you make the array global.

David.