MicroPython Images

Hi @Ash27!

The recommended way to load PNG images on ESP32+ILi9341 is by using the imagetools library.

You can use it like this:


import lodepng as png
import lvgl as lv
import lvesp32
from ili9341 import ili9341
from imagetools import get_png_info, open_png

lv.init()
disp = ili9341(dc=32, cs=33, power=-1, backlight=-1)

decoder = lv.img.decoder_create()
decoder.info_cb = get_png_info
decoder.open_cb = open_png
with open('png_decoder_test.png' ,'rb') as f:
      png_data = f.read()

png_img_dsc = lv.img_dsc_t({
    'data_size': len(png_data),
    'data': png_data})

scr = lv.scr_act()
img1 = lv.img(scr)
img1.align(scr, lv.ALIGN.IN_TOP_LEFT, 0, 0)
img1.set_src(png_img_dsc)

Also, please try other PNG files, maybe the problem is specific to the PNG file you are using.
Try this one for example:
image