QImage max size
-
When I am forming QImage with format QImage Format :: FormatMono with size more than 32767x32767, it is formed, however, when i am trying to render something on this image beyond the boundaries of the above, all trimmed. Why?
For example, this image has size 82500x30000, but it was trimmed on the border 32767.
-
@bronstein87 said in QImage max size:
32767
please show your painting code. You probably have some conversion errors (if you are on a common Desktop environment)
What Qt version are you using?
On what system are you on? -
QPainter documentation says:
Limitations
If you are using coordinates with Qt's raster-based paint engine, it is important to note that, while coordinates greater than +/- 2^15 can be used, any painting performed with coordinates outside this range is not guaranteed to be shown; the drawing may be clipped. This is due to the use of short int in the implementation. -
@mtrch
good catch.I am wondering if a workaround using QPainter::translate() is working, or if it also runs into the same limitation in the end.
-
@raven-worx
QT version- 5.7, system - win7 64.
Code example:QImage* example_img= new QImage(40000,40000,QImage::Format_Mono); QPainter painter_for_text(example_img); QPen pen_for_text; pen_for_text.setColor(QColor(255,255,255,255)); QFont font = painter_for_text.font(); font.setPixelSize(8000); painter_for_text.setFont(font); painter_for_text.setPen(pen_for_text); painter_for_text.drawText(20000,20000,QString("HELLO,HELLO,HELLO")); QImageWriter writer; writer.setFormat("tiff"); QString filename_save = QFileDialog::getSaveFileName(this, tr("Save tiff"), ".", tr("tiff files (*.tiff)")); writer.setFileName(filename_save); writer.write(*example_img);
-
I looked into qpainter.cpp and there is no any short int in implementation
[https://searchcode.com/codesearch/view/33959834/](link url) -
it might be OS limitation.
At least windows used to have it.
Didnt check lately. -
@bronstein87 said in QImage max size:
I looked into qpainter.cpp and there is no any short int in implementation
[https://searchcode.com/codesearch/view/33959834/](link url)Read carefully. It's not the QPainter that is limited by usage of shorts, it's the raster paint engine. For example look in
qpaintengine_raster.cpp
. It uses short for any type of clipping.Btw. 82500x30000 is like 300Mb of data (in mono format). Can't you chop it into smaller pieces?
-
@Chris-Kawa the point of creating such a large image, is to not merge it manually after...