It seems like a resouce problem, maybe with not enough RAM available? Or some system policy?
It seems like a resouce problem, maybe with not enough RAM available? Or some system policy?
Possibly related... If imagelist is NULL (line 11) then you allocate one (13) but don't set the file name before trying to read at line 19.
I think constructor at line 13 takes file name as argument.
Oh yes, my bad.
It does appear to be a resource issue. I am going to try scaling the QImages after I read them, deleting the larger QImage and saving the scaled image and see if that resolves the problem.
QImageReader has the capability of reading the images already scaled down, at least for some formats.
mlr (21st June 2011)
Reading the image in scaled down form performs better than scaling down after reading.
A 4288 x 2848 image with 24-bits per pixel is ~36MB per image uncompressed in memory (48MB if there's an alpha channel). Loading lots of these is certainly a rapid way to consume memory.
The issue is resolved. After reading in the image with the QImageReader I scale it to make it the dimensions I will draw it at and delete the original image. The resource issue no longer occurs in this situation and all of the images get drawn. But the performance is very slow where there are 100s of large images (4288 x 2848) so I want to see if I can just read in the thumbnail to begin with and not have to read in all of those large images.
Read what I said again -- you can load the image already scaled. Performance will be much better then. See QImageReader::setScaledSize().
Bookmarks