QImageReader::SetClipRect limitation on size(Large Image)
-
The limitation on rect varies on systems, which I don't know why.
I want to display a very large image 20000 x 30000 of image on graphicView.
anyone encounter the limitation on this?@
SetClipRect
{
System:
Dell Vostro 1510
Intel Core 2 Duo T8100 2.09 GHz
3 GB of RAM
Window XP 32 bit service pack 3
QImageReader::setClipRect() support up to 13824 x 13824(vice versa) onlySystem:
AMD QuadCore phenom 3 GHz
8 GB of RAM
Window XP 64 bit
QImageReader::setClipRect() support up to 14234 x 14235(vice versa) onlySystem:
Dell Vostro 1400
Intel Core 2 Duo T7250 2.0 GHz
2 GB of RAM
Window XP 32 bit service pack 3
QImageReader::setClipRect() support up to 15000 x 15894(vice versa) onlySystem:
Dell Vostro 3700
Intel Core i5 2.27 GHz
4 GB of Ram
Window 7 64 bit
QImageReader::setClipRect() support up to 18880 x 18881(vice versa) only
}
@EDIT: please use code highlighting by @-tags. thanks. Gerolf
-
[quote author="naughtykid" date="1299743480"]The limitation on rect varies on systems, which I don't know why.
I want to display a very large image 20000 x 30000 of image on graphicView.
anyone encounter the limitation on this?[/quote]Are you aware that a 20k x 30k / 32bpp image requires 234E8 byte = 2,4 GByte of contiguous memory for being loaded? Yes, QImage isn't that smart. Split the image in chunks and load them on demand or so.
-
Thank you for the reply.
Here's what I did:
@
{
QImageReader reader1(file);
reader1.setClipRect(QRect(halfWidth, 0, halfWidth, halfHeight));
QPixmap img01 = QPixmap::fromImage(reader1.read());
QGraphicsItem* itemHolder = reinterpret_cast<QGraphicsItem*>(_scene.addPixmap(img01));
}{
QImageReader reader2(file);
reader2.setClipRect(QRect(0, 0, halfWidth, halfHeight));
QPixmap img02 = QPixmap::fromImage(reader2.read());
QGraphicsItem* itemHolder = reinterpret_cast<QGraphicsItem*>(_scene.addPixmap(img02));
}{
QImageReader reader3(file);
reader3.setClipRect(QRect(halfWidth, halfHeight, halfWidth, halfHeight));
QPixmap img03 = QPixmap::fromImage(reader3.read());
QGraphicsItem* itemHolder = reinterpret_cast<QGraphicsItem*>(_scene.addPixmap(img03));
}{
QImageReader reader4(file);
reader4.setClipRect(QRect(0, halfHeight, halfWidth, halfHeight));
QPixmap img04 = QPixmap::fromImage(reader4.read());
QGraphicsItem* itemHolder = reinterpret_cast<QGraphicsItem*>(_scene.addPixmap(img04));
}ui.graphicsView->show();@
Just to confirm is this the correct way to split the image in chunks. I'm still pretty new to Qt :)