When forming an image QImage Format Format::FormatMono size larger than 32767х32767, it is formed, however, when you try to draw something on this image beyond the borders of the above-mentioned border, everything is cropped. Why? enter image description here

As you can see from above, the image size is 30000x80000; however, when you exceed the limit, everything is cropped.

compiler mingw32, OS win7 64. Example code:

 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); 
  • Let's code in the studio. The image can be embedded through base64-coding. And the second point - what is the bitness of the assembly target and the target OS? - Majestio
  • @Majestio, updated - bronstein87
  • in the code - not a single check! Especially after new. Try checking. Chuyka suggests that the 32-bit OS does not pull this picture. - Majestio
  • @Majestio, very much pulls, the picture is created, but when applying something to it, everything that turns out to be abroad 32767 is clipped. - bronstein87
  • @Majestio, and OS 64-bit, I wrote, but I collect mingw32 - bronstein87

1 answer 1

The problem is that the rasterizer in Qt is trimmed, and working with images whose dimensions exceed short is impossible. http://doc.qt.io/qt-4.8/qpainter.html#limitations

It is important to note that it can be used; the drawing may be clipped. Int.

It says that drawing CAN be cropped, but it will always be cropped, because the source code can be seen as follows:

 // This limitations comes from qgrayraster.c. Any higher and // rasterization of shapes will produce incorrect results. const int QT_RASTER_COORD_LIMIT = 32767;