Large offscreen bitmap, QImage *toImage* failing
-
Qt 5.9.2, MSVC 2015, Windows 10.
The C++ application I'm writing creates offscreen images based on the source data file, in a new case with a very large file the offscreen image is huge, using Qt Creator I can see the offscreen painter is set-up and I paint to it, the issue is when I want to take part of the offscreen painter to display:
QImage imgStrip(mpOffscreen->toImage()); if ( imgStrip.isNull() == true )
imgStrip is returning null, the height of the offscreen area is 800168.
Is there an alternative to toImage so instead of taking the whole offscreen painter as an image I can take a specific section of it?
-
@eyllanesc said in Large offscreen bitmap, QImage *toImage* failing:
https://stackoverflow.com/questions/7080052/qimage-qpixmap-size-limitations
Thank you, I will have to rethink how I'm doing this, in the original design this sort of size was never factored in, It's just be sprung on me.
-
Does anyone have a solution or suggestion?
The problem and requirement is, given a dataset, these are called B-Scans. A B-Scan consists of 6 sections. I have definitions in a database called BScanX and BScanY which defined how many pixels a B-Scan occupies. X = 32, Y = 8.
I determine the number of B-Scans from the file, the current worse case is 100021. The margin around the data area is 4 pixels, there is also a border all around of 4 pixels, which means an area of:
8 + 8 + (6 * 32) = 208 pixels wide
8 + 8 + (10021 * 8) = 80184 pixels highEven if I reduce the BScanY to 1 it will results in: 10037 pixels high.
For other data sets which are very much smaller I obviously have areas that are smaller than 32767 and therefore can create a QImage from the painter context without any problem. I have spinners to set the minimum and maximum values to allow the user to zoom into a dataset, once the image is captured it is then scaled using the spinner values and then resized to fit a visible area.
There is also a slider that functions like a scrollbar that allows the user to move the visible area through the offscreen image. This all works really well, or it did because it doesn't work at all with larger datasets.
-
@SPlatten For showing images you should use https://doc.qt.io/qt-5/qpixmap.html
Did you try that?
And even with croping you can still implement scrolling, but it will of course require some work. -
@jsulm said in Large offscreen bitmap, QImage toImage failing:
Yes thats exactly what I'm doing, I'm using toImage, however the QImage is limited to 32767x32767, thats the problem.
-
Hi,
What about stitching several QImages together ?