You are not logged in.

1

Tuesday, August 25th 2009, 12:04pm

Any idea how to view a large image?

Any idea why the code below succeeds for small *.png's (300 pixels) but fail (i=0, j=0) for bigger (1700*900 pixels)?

void viewImage::showImage(const QString file, QLabel* theLabel)
{
theLabel->hide();
QPixmap* image;
image = new QPixmap(file);
int i = image->width(); //TODO: Remove - debug purpose only
int j = image->height(); //TODO: Remove - debug purpose only
if (!image->isNull())
{
theLabel->setPixmap(*image);
}
theLabel->show();
}

PS. 700*600 resulted in KERN-EXEC 3, i.e. the image was not Null, but the system couldn't handle it...

PPS. Scaling the image works for medium sized, as they are not Null, but the main queastion remains: why "new QPixmap()" fails for large file.
// Not using "..ToWidth" or "..ToHeight" as "scaled" covers both!
theLabel->setPixmap(image->scaled(350,200,Qt::KeepAspectRatio,Qt:: SmoothTransformation));

This post has been edited 4 times, last edit by "kalastaja" (Aug 27th 2009, 9:23am)


Junior

Professional

  • "Junior" is male

Posts: 1,613

Location: San Antonio, TX USA

Occupation: Senior Secure Systems Engineer

  • Send private message

2

Tuesday, August 25th 2009, 1:25pm

kalastaja,

QPixmap internally automatically uses QPixmapCache. The default size is 1024. Your ( 700 * 600 * 32 / 8 > 1024 );

Check out QPixmapCachefor how to handle large file size pixmaps.


Junior

3

Tuesday, August 25th 2009, 2:36pm

very useful,thanks
i got this,could it is help for you?

Optimizing with QPixmapCache
http://doc.trolltech.com/qq/qq12-qpixmapcache.html

4

Wednesday, August 26th 2009, 8:22am

Moving forward

Very good - thanks!

And when one proceeds, UP jumps the next thing: EPOCHEAPSIZE in the mmp-file.
Qmake generates the file and therefore it "can't" be edited. I would need to raise
the value, but I don't know where to tweak it!

5

Thursday, August 27th 2009, 9:22am

Epoc heap size fixed!

Carbide wasn't exactly user friendly, but I finally succeeded by copying a variable (couldn't add one).

A 500 KB jpg-image (2514*1885) is ok, but 900 kB (3575*2681) already fails to load. Png-files are physically bigger, of course, but we remain below abt. 3200*1715.

I've tweaked the cache: QPixmapCache::setCacheLimit(2048 );
and increased the Epoc heap: symbian:TARGET.EPOCHEAPSIZE = 0x2000 0x2000000

... Not being able to view a 1M-file seems .....