QImage/QPixmap size limitations?

前端 未结 4 2025
粉色の甜心
粉色の甜心 2020-12-03 17:54

Are there any known size/space limitation of QPixmap and/or QImage objects documented? I did not find any useful information regarding this. I\'m c

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-03 18:23

    Both are limited to 32767x32767 pixels. That is, you can think of them as using a signed 16-bit value for both the X and Y resolution.

    No axis can ever exceed 32767 pixels, even if the other axis is only 1 pixel. Operating system "bitness" does not affect the limitation. The underlying system may run into other limits, such as memory as you mentioned, before such a huge image can be created.

    You can see an example of this limitation in the following source code: http://git.zx2c4.com/qt/plain/src/gui/image/qpixmap_x11.cpp

    if (uint(w) >= 32768 || uint(h) >= 32768) {
        w = h = 0;
        is_null = true;
        return;
    }
    

提交回复
热议问题