How to load images into a page only if needed


I am currently playing around with the page widget in the simulator to get an impression of this library.

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

I am using a i.MX6 DualLite MCU

What do you want to achieve?

I would like to have a page with many images, but don’t want to load all the images into RAM at once. Therefore, I wanted to load and decode the images basically when I run out of images while I am scrolling.
Maybe there is a way to achieve this which isn’t that obvious?

What have you tried so far?

I read the documentation.

Code to reproduce

Screenshot and/or video

As far as I can tell from the source code, images do not get loaded or decoded until they become visible on the screen.

So you should be able to create many image objects, and only the ones initially visible will get decoded (the rest will be decoded as you scroll).

1 Like


thanks for the information.
Should have looked it up myself in the source code.
I don’t know why I assumed the page widget would use the naive approach …


Also take a look an Image caching.