Problem converting/displaying images using TFT_eSPI library on ESP32

Hi all!

I have an ESP32 wired up to a generic 2.8 TFT SPI display and using the GitHub - Bodmer/TFT_eSPI: Arduino and PlatformIO IDE compatible TFT library optimised for the Raspberry Pi Pico (RP2040), STM32, ESP8266 and ESP32 that supports different driver chips library I have the display working. All the examples included with the library compile and execute fine.

The problem I am having is with creating my own graphics and trying to display them. I created a 32x32px image of a gray circle with a red/white gradient center. I have attached that file 'circle.png' to this post. I run the image file through this online converter - Rinky-Dink Electronics. I download the file and copy the data from the file into an example sketch included with the TFT_eSPI, and make changes as needed to the code.

In this case, when the image is displayed, the outsides of the circle are clipped, and there are a couple of stray white pixels being displayed.

Here is my code:

// Icon images are stored in tabs ^ e.g. Alert.h etc above this line
// more than one icon can be in a header file

// Arrays containing FLASH images can be created with UTFT library tool:
// (libraries\UTFT\Tools\ImageConverter565.exe)
// Convert to .c format then copy into a new tab

/*
 This sketch demonstrates loading images from arrays stored in program (FLASH) memory.

 Works with TFT_eSPI library here:
 https://github.com/Bodmer/TFT_eSPI

 This sketch does not use/need any fonts at all...

 Code derived from ILI9341_due library example

 Make sure all the display driver and pin comnenctions are correct by
 editting the User_Setup.h file in the TFT_eSPI library folder.

 #########################################################################
 ###### DON'T FORGET TO UPDATE THE User_Setup.h FILE IN THE LIBRARY ######
 #########################################################################
*/

#include <TFT_eSPI.h>       // Hardware-specific library

TFT_eSPI tft = TFT_eSPI();  // Invoke custom library

// Include the header files that contain the icons
#include "circle.h"


void setup()
{
  Serial.begin(115200);
  tft.begin();
  tft.setRotation(1);	// landscape

  tft.fillScreen(TFT_BLACK);

  // Swap the colour byte order when rendering
  tft.setSwapBytes(true);

  // Draw the icons
  tft.pushImage(140, 100, circleWidth, circleHeight, circle);

}

void loop()
{
  // do nothing
}

and the circle.h code make this message too long to post, so I am attaching it to this post along with the .ino file.

Any ideas where I might be going wrong?

Thanks for any help,
Randy

circle.png

TFT_Flash_Bitmap_Test.ino (1.43 KB)

circle.h (9.86 KB)

Have you solved this issue?
I have tested your circle.h code and works fine for me, but here the weird part...
If I remove the line tft.setSwapBytes(true);
I have the same effect that you mentioned on the rendering.
When I swap bytes it shows the image properly.

Maybe you can try with...
tft.setSwapBytes(false);