Pictures on TFT from SDcard, colorbug

Hey everybody,

My TFT works fine for everything excepted showing pictures from SDcard.
I tried 2 libraries, TinyFat which does not work below 2 Go so that sucks.

And also UTFT_SdRaw which is really mysterious to me ;

  • it does not display in the right color
  • it change the background color of the picture to white
  • I can not multiply the size of the picture

Here is my demo-test-code ;

#include <SPI.h>

#include <SdFat.h>
#include <UTFT.h>
#include <URTouch.h>
#include <UTFT_SdRaw.h>
extern uint8_t SmallFont;
extern uint8_t BigFont;

#define SD_CHIP_SELECT 53 // SD chip select pin
// file system object
SdFat sd;
// print stream
//ArduinoOutStream cout(Serial);

UTFT myGLCD(ILI9486, 38, 39, 40, 41);

UTFT_SdRaw myFiles(&myGLCD);

void setup()
// Open serial communications and wait for port to open:
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
Serial.println(F(“Initialising SD card…”));
bool mysd = 0;
// see if the card is present and can be initialized:
while (!mysd)
if (!sd.begin(SD_CHIP_SELECT, SPI_FULL_SPEED)) {
Serial.println(F(“Card failed, or not present”));
mysd = 1;
Serial.println(F(“Card initialised.”));
Serial.println(F(“Initialising LCD.”));

Serial.println(F(“LCD initialised.”));

myFiles.load(0, 0, 48, 63,“1image48x63.RAW”,1,0);
myFiles.load(100, 100, 60, 51,“Thermometre.RAW”,1,1);
myFiles.load(200, 200, 30, 30, “Clock.raw”,4,0); //myFiles.load(x coordinate, y coordinate, image-x-size, image-y-size, fname[, buffer-size-multiplier, invert colour]);


void loop()

As you can see in attachment (original picture file vs result on display), the original color is not the same at all, and the background of all pictures should be black.
Impossible to multiply the size
And even when I set invert colour to 0 or 1, it’s still wrong ( excepted for the thermometer and even the picture is not that clear).

I’ve been working on this problem for a while, and it is the last step for my project, really frustrating.
I start to get fed up, close to buy a 2 Go SD and using tiny but it would a really stupid constrain.
Any help would be appreciated !

Thanks guys



What you say is a good thing, and I got something out of it.

Oh really ? I would like to get something out of it too

It’s been a month that I try to fix this problem.

Still no solution…

Got my SDcard 2 Go, formated in FAT32
Tinyfat does not work at all

and SDraw does not show the real color of the picture… even if I play with its “invert color” option or not, both give a wrong version.

Any idea ?

It’s the last step of my project but I really start to give up.

Here in attachment you can see the original png picture of the thermometer, and its version converted in RAW format thanks to the converter inside of the UTFT library. In any case it gives me a white background while it’s black on the original version, and for all others pictures, the colors just go crazy



Hi! I have a TFT with ILI9486 too, with the DUE and UTFT.h. With the "ImageConverter565" i got good results, but I hate to convert everything. Here is my way. Not fast, but satisfactorily. So I figured out, where the data in a normal 24-bit color *.bmp allocated. A hex-editor was helpfully. The result: Byte '18' *1 + Byte '19'*256 is the width, '22'+'23'*256 is the height and '2'+'3'*256 is the size of the *.bmp. Now calculate the size vs. the width*height. Not equal means: each row has 2 zeros on its end. Equal: only data. From Byte 54 are the data. G,B,R for 1 pixel and so on. read these data, fill in a 'draw.pixel' and locate it on the screen. with loops for x and y you cal draw the bmp. If there is enough memory, you can fill the whole file in an array. Otherwise read 3 bytes and draw. Watch and drop the possible zeros! You can play with x and y or with R,G,B - enjoy!