What should I do if the memory is insufficient when using QImage to load a large image? A picture is about 2M, which is a 4K picture
-
wrote on 29 Jul 2023, 06:47 last edited by
What should I do if the memory is insufficient when using QImage to load a large image? A picture is about 2M, which is a 4K picture
It is necessary to draw a moving ball on the QImage. In order to realize this function, I frequently redraw the PNG image on the canvas, which will report insufficient resources. Is there a solution?
1.Error loading pictures
2.Redraw the background every 0.1 seconds,Draw another moving ball -
What should I do if the memory is insufficient when using QImage to load a large image? A picture is about 2M, which is a 4K picture
It is necessary to draw a moving ball on the QImage. In order to realize this function, I frequently redraw the PNG image on the canvas, which will report insufficient resources. Is there a solution?
1.Error loading pictures
2.Redraw the background every 0.1 seconds,Draw another moving ballwrote on 29 Jul 2023, 07:36 last edited by@good_hearted
About how much (free) memory does your machine have? Do you get an error message which you can paste here? Can you produce a few lines of code which show this error? -
@good_hearted
About how much (free) memory does your machine have? Do you get an error message which you can paste here? Can you produce a few lines of code which show this error?What does '4k' mean? 4000x2000 pixel? If so you need at least 400020004bytes = 32MB of free, contiguous memory.
As @JonB already said - please show use your loading and displaying code.
Also it's not a good idea to load an image every 0.1 second.
2/3