[Qt-interest] Creating jpeg/png image from Qt
Deepak Chandran
dchandran1 at tinkercell.com
Tue Dec 30 00:30:11 CET 2008
I have done this using the following:
QPixmap pixmap(1024,1024);
pixmap.fill(QColor(255,255,255,255));
QPainter painter(&pixmap);
painter.setRenderHint(QPainter::Antialiasing);
graphicsScene.render(&painter,QRectF(), graphicsScene.itemsBoundingRect());
pixmap.save(fileName + tr(".PNG"),"PNG");
Hope that helps. I usually save the scene as PDF:
QPrinter printer(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOrientation(QPrinter::Landscape);
printer.setOutputFileName( "file.pdf");
QPainter painter(printer);
painter.setRenderHint(QPainter::Antialiasing);
graphicsView->render(&painter);
On Mon, Dec 29, 2008 at 4:22 AM, Ankit Agarwal <ankit17.ag at gmail.com> wrote:
> Hi,
> I have two similar requirement,
> 1. I have a graphics scene which has a lot of items. I need to the excat
> image of the graphicsScene (something like a snapshot of the graphics
> scene).
> 2. I have make qwt plot. I need the plots as images.
>
> How can I achive this?
>
> --
> Thanks & Regards,
> Ankit Agarwal
> SW Engineer
> Vegayan Systems
> email : ankit_agarwal at vegayan.com
> Blog : http://ankit17.wordpress.com
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20081229/89cf780b/attachment.html
More information about the Qt-interest-old
mailing list