[Qt-interest] Interested in Tiling large images
Boudewijn Rempt
boud at valdyas.org
Thu Jun 9 20:08:51 CEST 2011
On Thursday 09 June 2011 Jun, Cole, Derek wrote:
> Hello,
>
> I am running into a problem trying to display large commercial imagery in a QGraphicsview/Scene.
>
> Presently, I have been putting my smaller sample images into QGraphicsPixmapItems. This generally requires generating a QImage from the raw byte data, pixmap from the QImage, and then sticking that pixmap into an item, and putting the item on the scene.
>
> Apparently one of these items has a limit on the size - could someone point me to the max constraints on these images?
>
> I have had no problem with my smaller test images that were about 8192^2 pixels. These test image are about 35000^2.
>
> I am reading the raw data out of a JPEG2000 driver, which is what is actually reading the file.
>
> It seems like I may have to go with some kind of tiling strategy..can anyone point me to how that generally works? I want to be able to view pan the image, zoom in/out, etc etc. I already have code for doing this on those QGraphicsItems. How do I tell which tiles to load(on the edge of my qgraphicsview I guess?), which to discard(not visible in my qgraphicsview?), how to translate what is on the screen to a position in the physical data file, etc?
I guess you could use a QGraphicsPixmapItem per tile -- say, a 1024x2024 tile system. But once you really need to show huge images, it's better to not depends on something precooked like QGraphicsView. Applications like Krita, Vips and Horizon all have custom code to make this work efficiently. When the images get really big, you also need to start doing your own swap code.
If you try to manage QGraphicsPixmapItem tiles yourself, i.e., discarding tiles once they are out of view and so on, you're basically rewriting QGraphicsView's scrolling anyway.
--
Boudewijn Rempt | http://www.valdyas.org, http://www.krita.org
More information about the Qt-interest-old
mailing list