PDA

View Full Version : Issue in exporting image with huge GraphicScene



rangde1pratu
20th March 2012, 09:32
I have been exporting huge graphicscene containing more than 10k shapes and texts on different shapes in it... I could export using following code..yet quality is so poor that text on images in not clear.. could you please help me on this?:

QImage image(7680, 4320, QImage::Format_ARGB32);
QPainter p(&image);
p.setBackground(Qt::white);
p.setRenderHints(QPainter::HighQualityAntialiasing , true);
p.setRenderHints(QPainter::TextAntialiasing, true);
this->render(&p);
p.end();
image.save(sFilePath, 0 ,100);

wysota
20th March 2012, 13:13
How large is the scene?

Spitfire
20th March 2012, 16:48
Instead of hardcoding image size, use QGraphicsScene::itemsBoundingRect() (warning: it's slow for large scenes).
If you're drawing scene larger than the image then it will get scaled down and result in poor quality.

rangde1pratu
13th April 2012, 08:06
Scene is 20000 x 40000.

wysota
13th April 2012, 09:21
7680 / 20000 = 0.384
4320 / 40000 = 0.108

which has a different aspect ratio.

Even considering it should be:

4320/20000 = 0.216
7680/40000 = 0.192

still the aspect ratio is different in each direction and still you lose around 80% of the details. How exactly do you expect to fit 8E+10 pixels of data into just ~3.3E+6 pixels without losing quality?