How to load large Image in QML
-
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 ?
-
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.
-
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
}
@ -
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.
-
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@@??
-
buy more memory?
-
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).
-
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@@ -
I know, I know, just joking.
-
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.
-
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++.