Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Loading Images with small CPU load
Has somebody experience what's the best or correct way for image loading with preferably a small CPU load ?
Because it's an embedded system I've to get along with a not very powerfull CPU.
I've over hundred images as png-Files. Everyone with size of 300 x 300 Pixel
In my usecase every 100 ms I've to replace an image with a new one. For the intervall I'm using a timer.
Can somebody give a tip ?
Thanks and best regards,
Depending on what these images you should avoid using a compressed format.
I'm using images in PNG-Format
@Snoopy PNG is compressed
timday last edited by
That much image data would be ~205MByte stored uncompressed (at 24bits/pixel) per hundred images. Might be a lot for an embedded system? But if you've got the storage available you could just store the raw image data into files and load when needed and point a QImage at the data. (Or memory-mapping the image data might be better depending whether usage patterns and available RAM lead to some caching and re-use of already loaded data).
For the intervall I'm using a timer.
How far did you get with the advice you got from https://forum.qt.io/topic/87537/need-a-timer-which-works-exactly/ ?
I've detected that in my case the QML Timer was the problem and not loading the images. The Timer himself is imprecise. I've checked it by comparing the elapsed time with the system time of the PC.
One more example: If there is only running the timer with an interval of 100 ms (without loading images), and I'm moving the mouse the triggeredEvents will be fired only after 180 ms in average.
Now I've integrated the QTimer based on C++ into my QML-code. I'm using the QTimer with type PreciseTimer.
This works very fine.
In combination with loading images I've opened a new topic
I would be very gratefull If you could look inside it. Maybe you have experience with this topic.
Pablo J. Rogina last edited by
@Snoopy you may want to take a look at a series of blog posts regarding Fast-Booting Qt Devices. Although some items covered there might not apply to you, some tips about do's and do not's could be relevant.