Optimize loading images from memory #3308
Replies: 4 comments 3 replies
-
|
Beta Was this translation helpful? Give feedback.
-
Hi! I am not entirely sure that I understand the question correctly - apologies if I’m off here :). However, I suggest that of loading the file from disk is expensive (because of I/O or decoding), then you could consider doing that in a separate thread with the image crate. When you’re ready, load the pixel data into a SharedPixelBuffer, call upgrade_in_event_loop on your weak app handle, and - in the closure - create the slint::Image from the pixel buffer and finally set the property. That way the operations in the UI thread are limited to a little bit of reference counting, instead of file I/O and decoding. Does that make sense? I wonder if we need an example perhaps that does that by loading an image feed from the network. Not sure what would be a good feed though. |
Beta Was this translation helpful? Give feedback.
-
I use reqwest to download the http multipart/x-mixed-replace mjpeg stream image and update the Image, but each frame passes through image::load_from_memory and creates a SharedPixelBuffer. On the low-performance iot development board, there will be a certain performance consumption, resulting in a screen Delay, if slint::Image:load_from_data is possible, may be a good solution |
Beta Was this translation helpful? Give feedback.
-
I'll convert this to a discussion. Let's explore more there :) |
Beta Was this translation helpful? Give feedback.
-
I have an image stream, and the image is continuously updated during the convenient process, but the image is delayed, and the reading and updating process is time-consuming. Is there any way to optimize it?
Beta Was this translation helpful? Give feedback.
All reactions