Display GIF distortion

Description

I use lv_gif_lib to display a gif on my screen with SD card,but the GIF’s color was distortion.And it can’t replay.

What MCU/Processor/Board and compiler are you using?

ESP32

What LVGL version are you using?

lvgl7.5.0 lvgl-feat-new-fs-api

What do you want to achieve?

Display a GIF

What have you tried so far?

Print log from open_cb,the log tell me the file is read too much .

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/
#include <Arduino.h>
#include "lvgl.h"
#include <TFT_eSPI.h>
#include "lv_fs_if.h"
#include "lv_gif.h"
#include "SD.h"


LV_IMG_DECLARE(w1)
LV_IMG_DECLARE(ez)

/* TFT */
TFT_eSPI tft = TFT_eSPI();
static lv_disp_buf_t disp_buf;
static lv_color_t buf[LV_HOR_RES_MAX * 100];

/* Display flushing */
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
{
    uint32_t w = (area->x2 - area->x1 + 1);
    uint32_t h = (area->y2 - area->y1 + 1);

    tft.startWrite();
    tft.setAddrWindow(area->x1, area->y1, w, h);
    tft.pushColors(&color_p->full, w * h, true);
    tft.endWrite();

    lv_disp_flush_ready(disp);
}
void setup() {
// write your initialization code here
    Serial.begin(115200);
    lv_init();
    lv_fs_if_init();
    tft.begin();
    tft.setRotation(1);
    lv_disp_buf_init(&disp_buf,buf,NULL,LV_HOR_RES_MAX * 100);
    /*Initialize the display*/
    lv_disp_drv_t disp_drv;
    lv_disp_drv_init(&disp_drv);
    disp_drv.hor_res = 240;
    disp_drv.ver_res = 240;
    disp_drv.flush_cb = my_disp_flush;
    disp_drv.buffer = &disp_buf;
    disp_drv.rotated = 1;
    lv_disp_drv_register(&disp_drv);

    if (!SD.begin()) {
        Serial.print("~");
        return;
    }

    Serial.println("SD card Ready!");
    lv_obj_t * img = lv_gif_create_from_file(lv_scr_act(),"S:/sd/sun1301.gif");
    lv_obj_align(img,NULL,LV_ALIGN_CENTER,0,0);

}

void loop() {
// write your code here
    lv_task_handler();
    delay(5);

}

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

2

'''
ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5828
entry 0x400806ac
Info: lv_init ready 	(lv_obj.c #186 lv_init())
Info: Object create ready 	(lv_obj.c #417 lv_obj_create())
Info: Object create ready 	(lv_obj.c #417 lv_obj_create())
Info: Object create ready 	(lv_obj.c #417 lv_obj_create())
SD card Ready!
Info: Object create ready 	(lv_obj.c #417 lv_obj_create())
Info: image created 	(lv_img.c #127 lv_img_create())
Info: OPEN 	(lv_fs_pc.c #128 fs_open())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: lv_img_set_src:  `LV_IMG_SRC_VARIABLE` type found 	(lv_img.c #180 lv_img_set_src())
Info: image draw: cache miss, cached to an empty entry 	(lv_img_cache.c #122 _lv_img_cache_open())
Info: Object create ready 	(lv_obj.c #417 lv_obj_create())
Info: label created 	(lv_label.c #167 lv_label_create())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: SEEK 	(lv_fs_pc.c #216 fs_seek())
Info: TELL 	(lv_fs_pc.c #253 fs_tell())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())
Info: READ 	(lv_fs_pc.c #183 fs_read())Preformatted text

my log was print like this.

Hello, I am confused about GIF decoding. Can you see your GIF decoding code?

when I decode, There will be

 if (memcmp(sigver, "GIF", 3) != 0) {
        fprintf(stderr, "invalid signature\n");
        goto fail;
    }

from where you find lv_gif.h file, is it available online or any reference for it?
I am trying to run gif file which is stored in SD card and trying to display on LCD using LVGL libraries

Hello, I would like to ask why I can use your picture to display normally, but not my own picture.