Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to load large Image in QML

How to load large Image in QML

Scheduled Pinned Locked Moved QML and Qt Quick
11 Posts 3 Posters 6.6k Views 1 Watching
  • 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.
  • R Offline
    R Offline
    rstalin
    wrote on last edited by
    #1

    hello

    I want to load a image ,size 3783 x 2743.
    Using Image component load directly,and it show nothing.

    I try to divide image to image tiles,every tile size is 500 x500.
    Then load every tile in gridview,gridview size is set 4000x3000.
    There are some gridview item can't show image,I guess the problem is memory used up.
    But i can't let gridview only use memory in visible area .

    Loading large image if have other good idea ?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Strange... I am loading 6738x4673 without any problems, even on a mobile device. I have it on a flickable element with clipping enabled. But if I remember well, it loaded correctly even without clipping.

      (Z(:^

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rstalin
        wrote on last edited by
        #3

        is really can loading 6738×4673 without any problems!!??
        I check mobile memory when load 3783 × 2743 in gridview it used about 56MB
        And i specify 64 mb in pro, it is very close the limit ,
        so i guess is memory problem
        @
        symbian: {

        TARGET.EPOCHEAPSIZE = 0x20000 \
            0x4000000
        TARGET.EPOCSTACKSIZE = 0x14000
        

        }
        @

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Well, I've got 1GB on my phone.

          Try to enable clipping, maybe it will help (only if some parts of the image are not visible, of course). Also, you can try modifying Image's sourceSize property, I think it had something to do with memory, too. Check the docs to be sure.

          (Z(:^

          1 Reply Last reply
          0
          • R Offline
            R Offline
            rstalin
            wrote on last edited by
            #5

            sierdzio,thanks your suggestion!

            Indeed set image sourcesize it can load correctly and the picture also become small.=w=

            If I don't want the picture become small or be clipped,

            have other ways can do that@@??

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              buy more memory?

              (Z(:^

              1 Reply Last reply
              0
              • sierdzioS Offline
                sierdzioS Offline
                sierdzio
                Moderators
                wrote on last edited by
                #7

                Sorry, a cruel joke :-)

                So, let me wrap it up:

                • you want to load a BIG picture
                • you lack memory to do that in full
                • you don't want to resize the picture
                • you want it to fit your screen

                If you want all that happen at once, I'm afraid it is not possible, no matter what framework are you using.

                Resize the picture physically yourself, or lower amount of colours (maybe it will use less memory in black and white, but I doubt it).

                (Z(:^

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  rstalin
                  wrote on last edited by
                  #8

                  Loading one large pix is used too much memory.
                  So I have a idea to do image tile like google map.
                  But gridview seem can't do that, it load all picture once.
                  If gridview can load memory only visible area maybe possibile
                  but i can't do that.
                  i dont't know javascript can do that or not@@

                  1 Reply Last reply
                  0
                  • sierdzioS Offline
                    sierdzioS Offline
                    sierdzio
                    Moderators
                    wrote on last edited by
                    #9

                    I know, I know, just joking.

                    (Z(:^

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      rstalin
                      wrote on last edited by
                      #10

                      Yeah sierdzio said can set pix in black and white give a good idea.

                      I don't set color in 2 colors ,but I set in 256 colors png8 format.

                      It indeed work.But it use 35 mb still too much memory.

                      256 colors in my calculate (3783 × 2743 x 8) / 8 /1024 /1024 should be used 9.89MB

                      In actual it use 35MB ,the difference very much.

                      There are seem something unknow working in qml background.

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        andre
                        wrote on last edited by
                        #11

                        That is because the data still needs to go to your video display, which does support more than those 256 colors. So the conversion still has to be made to full color.

                        The only thing I can think of, is really to go with tiling. You will need to be more aggressive than just chopping into 6 pieces though, I think you will need many more. You will need to set the contents of these pieces, I think only when they become visible. Perhaps all that is feasible with QML, but perhaps you just need to write a QML Item that can do that in C++.

                        1 Reply Last reply
                        0

                        • Login

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