PDA

View Full Version : import large number of images



sriluyarlagadda
14th May 2008, 09:07
hai everyone,

I am trying to import large number of images into my mainwindow(for a photo management application) more than 5k images. But since when u try to load those many images the ram and the swap are completely filled. and it gives out of memory error.
Also when loading limited collections(i expect the images to be displayed on runtime when the images are being imported but the images are'nt displayed on runtime and only displayed after the loading is complete.And the main window gets blurred until then.

I am using qlistwidgetitem(icon mode) to display the images.and the icons are of standard 50*50 size.

how could i accomodate largenumber of images(above 5k as i mentioned earlier) and how can I load the listwidgetitems load at run time? (Fedora core 8,Qt 4.3.4)

Thanks in advance

srihari

jpn
14th May 2008, 10:15
I'd say that the only way to keep a view with that amount of thumbnails anyhow scalable is to show images on demand. Don't attempt to load all images in memory but re-use a certain set of items to show currently visible images.

sriluyarlagadda
14th May 2008, 10:20
how do u do that exactly? I thought qt will take care of such things....

sriluyarlagadda
14th May 2008, 10:26
I have been using the following code...

listwidgetitem->setIconsize(QSize(50,50); //1
listwidgetitem->setIcon(QIcon("/home..../temp.jpg"); //2

how does qt store an icon? does it store the original image in RAM and scales it down when needed. or does it store the scaled down image in ram. if it is the first case then it eats up the memory.

I have been looking into FSpot photo manager. he has been loading thausands of images and the ram was just occupying < 300MB.

what do u think? if i could create a qpixmap scale it down pass that to the setIcon function and delete the original pixmap?

I heard that libexif stores thumbnails along with other info so is it better if i use it?

sriluyarlagadda
14th May 2008, 12:05
does anyone have ideas ?

aamer4yu
15th May 2008, 10:26
Try to know which items are visible...
load images only in those items/labels.

When u scroll, unload the images not in view and load new images,,,
this might be tricky,,, but only thing i can think of as of now