Images loading faster?

Is there a way that I can make images that are read off of a SD card load faster? My code is below. This is not the complete code but enough to load a boot logo then a single screen.

// VERSION:  1.0
// - initial version

// - ////////////////////////////  BEGIN GLOBAL VARIABLES  ///////////////////////////////////////
// - /////////////////////////////////////////////////////////////////////////////////////////////
// - /////////////////////////////////////////////////////////////////////////////////////////////

#include <Wire.h> // needed by tons of stuff
#include <EEPROM.h>  // used to store and retrieve settings from memory
#include <UTFT.h>  // used to interface with the TFT display
#include <UTouch.h>  // used to interface with the touch controller on the TFT display
#include <tinyFAT.h> // used to access the SD card
#include <UTFT_tinyFAT.h>  // used to read .raw images from the SD card
#include <RTClib.h>

#include <Time.h> // allows conversion to UNIX time for easier date/time math
#include <TimeAlarms.h>  // used to power schedules
#include <OneWire.h> // network library to communicate with the DallasTemperature sensor, 
#include <DallasTemperature.h>  // library for the Temp sensor itself

// Declare which fonts we will be using
extern uint8_t SmallFont[];
extern uint8_t Sinclair_S[];
extern uint8_t arial_bold[];
extern uint8_t Ubuntubold[];

// Pins for temperature sensor
#define ONE_WIRE_BUS_W 47         //water sensor on pin 47

// for time
// for time calcuation, we need to know the current time zone offset
//int UTC_Offset=-5;

// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWireW(ONE_WIRE_BUS_W);

// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensorW(&oneWireW);      //water sensor

UTFT myGLCD(CTE50,38,39,40,41); // start up an instance of the TFT screen
UTouch myTouch(6, 5, 4, 3, 2);  // start up an instance of for touch

UTFT_tinyFAT myFiles(&myGLCD);  // start up an instance to read images from the SD card

// days and month character strings for displaing at the top of the screen
char *Day[] = {
char *Mon[] = {
int x, y; //touch coordinates

// - ////////////////////////////  END GLOBAL VARIABLES  /////////////////////////////////////////
// - /////////////////////////////////////////////////////////////////////////////////////////////
// - /////////////////////////////////////////////////////////////////////////////////////////////
// - /////////////////////////////////////////////////////////////////////////////////////////////
// - /////////////////////////////////////////////////////////////////////////////////////////////
// - ////////////////////////////  VOID SETUP CODE BELOW  ////////////////////////////////////////

void setup()
// initiate the screen and touch 
  // init SD card
  // clear the screen
  // boot up logo
  myFiles.loadBitmap(230, 40, 378, 268, "Logo.raw");
  myFiles.loadBitmap(340, 360, 149, 47, "Copy.raw");

  // Home Screen
  myGLCD.setColor(51, 204, 51);
  myGLCD.print("Management System", 150, 15);
  myFiles.loadBitmap(50, 5, 103, 77, "Froggy.raw");
  // Outer lines
  myGLCD.drawLine(40, 60, 53, 60); //Top Header -hand
  myGLCD.drawLine(79, 60, 121, 60); //Top Header -hand
  myGLCD.drawLine(147, 60, 760, 60); //Top Header -hand
  myGLCD.drawLine(40, 440, 760, 440); //Bottom Footer
  myGLCD.drawLine(40, 60, 40, 440); //Left Side
  myGLCD.drawLine(760, 440, 760, 60); //Right Side
  myGLCD.drawLine(390, 60, 390, 440); //Down Middle
  myGLCD.drawLine(390, 235, 760, 235); //Middle Across
  myGLCD.drawLine(390, 335, 760, 335); //Temp Section across
  myGLCD.drawLine(510, 235, 510, 335); //Temp down 1
  myGLCD.drawLine(635, 235, 635, 335); //Temp down 2

  // Touch Icons Row 1 
  myFiles.loadBitmap(55, 90, 99, 135, "Lights.raw");
  myFiles.loadBitmap(154, 90, 102, 135, "Temp.raw");
  myFiles.loadBitmap(256, 90, 125, 135, "Humidity.raw");

  // Touch Icons Row 2
  myFiles.loadBitmap(45, 260, 129, 131, "Misting.raw");
  myFiles.loadBitmap(174, 260, 88, 131, "Fan.raw");
  myFiles.loadBitmap(262, 260, 122, 131, "Settings.raw"); 
  // Viv logo
  myFiles.loadBitmap(400, 70, 360, 156, "Vivlogo.raw");
  // Temp
  myFiles.loadBitmap(408, 245, 88, 23, "Templeft.raw");
  myFiles.loadBitmap(524, 245, 103, 23, "Tempmid.raw");
  myFiles.loadBitmap(653, 245, 96, 23, "Temprt.raw");
  myFiles.loadBitmap(400, 360, 147, 54, "Hum.raw");  
  //myGLCD.setColor(255, 255, 255);
  //myGLCD.print("Right", 620, 245);


// - /////////////////////////////////////////////////////////////////////////////////////////////
// - /////////////////////////////  VOID LOOP CODE BELOW  ////////////////////////////////////////
// - /////////////////////////////////////////////////////////////////////////////////////////////

void loop()


To add more information, I have a SainSmart 7" inch TFT LCD Display Touch Screen that states it is integrated with "8-page video memory"

Would this make it load faster and if so, how would I utilize this?

Hi Bigsease,

That makes sense!! Now you have said has 8 page video memory, your display IS a cpld panel.... As such your init code should be UTFT myGLCD(CPLD,38,39,40,41); Not sure how it managed to work with CTE50, but it does explain the problems you are having with touch calibration.

Can you use it speed up drawing? Yes and no.....

The MEGA is WAY SLOOOOOOOOOOWWWWW drawing full screen 800x480 pictures. On my DUE I have managed to make my own modified version of UTFT_tinyFAT which can bang out pictures from SD pretty swiftly :-

ghlawrence2000: Hi Vile,

WHOOOAAAA, 22 seconds to display 779x348!!

Hmmmm. Having experienced the same problems mboroff had, I took a different approach and modified UTFT_tinyFat to use SdFatLib. This allows us to use any size SD card, and folders.

Images need to be converted to .raw using Hennings converter which is included with UTFT library.

My version of UTFT_tinyFAT draws the following image sizes from Class 6 Samsung 32GB SD to 5" CPLD CTE TFT using CTE Shield and Arduino DUE.

240x240 , 125ms 320x240 , 174ms 440x440 , 420ms 779x348 , 581ms 800x480 , 815ms

If you are interested, reply here.



PS. TFTLCDCyg refers to my modified version of UTFT_tinyFAT. Be aware the earlier version has bad colour, you need the later version.

It maybe be faster then Hennings tinyFAT and UTFT_tinyFat, I am not sure, it is so long ago since I really played with my Mega, but the HUGE advantage is as stated in the quote, any size SD card, and folders, and due to updates in SdFatlib, now with long file name ability also ;).

To answer your original question, can the video pages be used to speed things up?

What you can do, is draw to a non-visible video page in the back ground, then flip the switch to display that page and it will be drawn almost instantly....... the actual preparation time is not going to be faster, but the user experience will.

Footnote: having changed UTFT init to display type CPLD..........try the touch cal again, I don't like things beating me...



Hey Graham,

Sorry for the delay in reply. I work in the oil field and am now back out here for two weeks. How would I go about drawing the screens in the background? I have tried different setups and code but I cant get anything to show. Below is a sample code format that I found elsewhere but have not made it work yet.

void setup()

  // display home screen


void loop()

void screenHome()  // draw main home screen showing overview info
//my screen layout

void screenSettings()  // Settings
//my screen layout

void screenPower()  // Settings
//my screen layout


Any advice on this?

Also, the codes that I posted on the other forum page were from using the new CPLD code. still showed Y to be upside down but I works as it should.

Thanks, David