Bodmer / TFT_eFEX

A support library for TFT_eSPI that adds commonly used extra functions
Other
83 stars 27 forks source link

Landscape images do not display correctly with function drawJpgFile() #9

Closed geprc closed 4 years ago

geprc commented 4 years ago

ESP32 dev module with ST7789 display connected to hardware SPI.

When trying to display a SPIFFS jpg image which is 135x135 landscape orientation the image displays smaller with a block of background colour filling the rest of the screen.

I've modified the example sketch like this:

void loop() {
       tft.fillScreen(random(0xFFFF));
       tft.setRotation(1);
       fex.drawJpgFile(SPIFFS, "/image.jpg", 0, 0);
}

Just like this: scale IMG_20191024_184102

Bodmer commented 4 years ago

It looks your screen has an offset of sbout 40 pixels. A quick fix is to add this offset in your sketch. Instead of 0,0 cordinates, try 40,40

geprc commented 4 years ago

40, 40 will be this IMG_20191025_125714 and 40, 70 will be this IMG_20191025_125840

geprc commented 4 years ago

and if i use function drawBmp(), it will be ok,it seems that function drawJpgFile() is not adaptation with st7789,or pixel 240*135

Bodmer commented 4 years ago

I have marked this as a bug. Thanks for raising the issue. The display you are using has some offsets so it appears that these are not being used when rendering a jpeg file.

You could try this new jpeg library.

I am not in a position to investigate the bug at the moment but will have a look in a few days time.

Bodmer commented 4 years ago

I have tested it with the new Tjpg_Decoder library here and this example works: SPIFFS_Jpg_T1.zip

Using the Tjpg_Decoder library is therefore an option for you until I can track down the bug.

Bodmer commented 4 years ago

I think I will be stripping out the ESP32 related jpeg code as it has a rather awkward API, and update the examples to use the TJpg_Decoder library, that library also uses a more up-to-date version of the decoder engine.