Results 1 to 5 of 5

Thread: Issue in exporting image with huge GraphicScene

  1. #1
    Join Date
    Mar 2012
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Issue in exporting image with huge GraphicScene

    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);

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Issue in exporting image with huge GraphicScene

    How large is the scene?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    3
    Thanked 106 Times in 103 Posts

    Default Re: Issue in exporting image with huge GraphicScene

    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.

  4. #4
    Join Date
    Mar 2012
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Issue in exporting image with huge GraphicScene

    Scene is 20000 x 40000.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Issue in exporting image with huge GraphicScene

    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?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Problems with QwtLegend when exporting image
    By BettaUseYoNikes in forum Qwt
    Replies: 0
    Last Post: 4th October 2011, 18:26
  2. Replies: 5
    Last Post: 3rd September 2011, 00:20
  3. QGraphcisView issue with mouse cursor image
    By dpatel in forum Qt Programming
    Replies: 0
    Last Post: 20th July 2010, 08:28
  4. Qt image support Issue in Installation?
    By vishal.chauhan in forum Installation and Deployment
    Replies: 2
    Last Post: 26th April 2007, 08:50
  5. Image issue
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 9th February 2006, 20:27

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.