Handling very large images in Qt

送分小仙女□ 提交于 2019-12-30 10:41:19

问题


I can't get Qt to work on images beyond 10,000X10,000. I'm dealing with huge satellite images that are around 2GB each. I considered using memory mapping but the image still occupies space in memory.

QFile file("c://qt//a.ras");
file.open(QIODevice::ReadOnly);
qint64 size = file.size();
uchar *img=file.map(0,size);
QImage I(img,w,h,QImage::Format_ARGB32);

Can anyone tell me a more efficient way to deal with large images in Qt?


回答1:


Qgraphicsview and a set of image tiles, the view handles all the scrolling and world coords for you.
Then you just have to either pre-chop the images into tiles in advance or pull a section of image data on the fly




回答2:


Can you use some sort of tiling strategy to load and manipulate the image piecewise, instead of all at once?




回答3:


I'm guessing you're using a 32-bit OS and you're running out of address space. The easiest solution may be to use a 64-bit OS (e.g. Windows 7 x64) and compile your app for 64-bit. What is your target platform (Windows, Mac OS X, Linux etc.)?

This may help.



来源:https://stackoverflow.com/questions/4797908/handling-very-large-images-in-qt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!