Having done something simular (not that large though, just rendering HD frames) if you need to render multiple of these, use another thread to do the save() call because the PNG compression takes forever and CPU cores are plentiful.
 
As for the 100k(!?) horizontal resolution... that might be a bit much. Maybe export quadrants?
 
 
 
 
Sent: Wednesday, September 28, 2016 at 5:31 PM
From: "Petric Frank" <pfr...@gmx.de>
To: "interest@qt-project.org" <interest@qt-project.org>
Subject: [Interest] QGraphicsScene and writing to file

Hello,

 

i have a QGraphicsScenewhich i want to write to a file (*.png, ...).

 

As documrmtation states i use the following:

------------------- cut ---------------------------

QGraphicsScene scene;  // previously filled

QRectF rect = scene->sceneRect ();

QImage img (rect.width () + 1, rect.height () + 1, QImage::Format_ARGB32);

img.fill (QColor (Qt::white).rgb ());

QPainter p (&img);

scene->render (&p);

p.end ();

img.save ("pict.png");

------------------- cut ---------------------------

 

But this does not work for bigger pictures. No error message. The viewer simply tells that the generated *.png file are corrupted.
The scenes reqire a width of about 100000 pixels.

 

After some searching in the web i found out the QImage (and QPixmap) seems to have an internal limitation of about 32k x 32k.

 

The PNG-format does not have such a limitation.

 

Any hints on how to export such a big scene to a PNG (or other) file ?

 

 

Currently i use Qt 5.6.1 (Linux 64 Bit) and Qt 5.2 (Windows 7 64 Bit).

Both hosts have 16 GB main memory.

 

kind regards

Petric

 

_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to