c++ - Qt5 QImageReader 奇怪的行为

标签 c++ qt image-processing qt5 32bit-64bit

我使用 QImageReader 测试了一个简单的代码

    scene = new QGraphicsScene(this);
    ui->graphicsView->setScene(scene);
    QPixmap pixmap;
    QImageReader reader("hubble.tif");
    reader.setClipRect(QRect(0,0,8000,8000));
    QImage img = reader.read();
    if (img.isNull())
        qDebug() << reader.errorString();
    else
    {
        pixmap = QPixmap::fromImage(img);
        scene->addPixmap(pixmap);
    }

当我用 Qt5.3.2_MSVC 2013_OpenGl 64 位编译它并用 18000x18000 的图像测试它时(感谢 Nasa Hubble Image ...),程序运行没有错误。 当我测试同一个程序但使用 Qt5.3.2_MSVC 2013_OpenGl 32 位编译时,程序失败并出现读者错误“无法读取图像数据”!

这是 Qt 中的错误还是只是 Qt 文档中未提及的 32 位版本的限制?

最佳答案

大小需要 18000 * 18000 * 23 = 1.266GB 连续内存的图像,在 32 位系统上您的程序可能没有。您可能会发现这有助于将其拆分为更小的 block 。 https://forum.qt.io/topic/4270/qimagereader-setcliprect-limitation-on-size-large-image/4

关于c++ - Qt5 QImageReader 奇怪的行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34180609/

相关文章:

c++ - 当用户输入错误的输入时,从 cin 中清除整行而不是一次清除一个字符

Qt 使用颜色和 alpha-map 绘制图标

c++ - 在OGDF中设置节点边界框​​大小

c++ - FFmpeg 中 RGB 到 YUV 的转换错误

php - PHP 中的动态图像生成

使用 MATLAB 和 C 将 .bin 转换为图像系数并创建二值图像

c++ - 使用 Eclipse 进行 C 编程(库之谜)

c++ - 将整数值分配给 unsigned char

c++ - 使用 Arduino 和 C++ 进行字符串操作

c++ - 未定义对 Qt 项目中 glew 方法的引用