Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. 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

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 197 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    good_hearted
    wrote on last edited by
    #1

    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

    JonBJ 1 Reply Last reply
    0
    • G good_hearted

      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

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @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?

      Christian EhrlicherC 1 Reply Last reply
      0
      • JonBJ JonB

        @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?

        Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        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.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        2

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved