View Full Version : Export GraphicsView contents as JPG
Terabyte
5th January 2009, 17:20
Hi, the following code doesn't seem to work, it should take a 'screenshot' of the contents of the whole of the QGraphicsView. For some reason it doesn't. The contents of the saved file is blank (open in notepad, no data at all).
If I change JPG to BMP it works, but the image is inverted. (black white white black)
Anybody know what I'm doing wrong?
jpn
5th January 2009, 17:40
What does:
qDebug() << QImageWriter::supportedImageFormats();
output?
philw
5th January 2009, 17:59
I had, I think, a related problem with JPG files. (As suggested also by jpn's response) ...
QImageWriter supportedImageFormats only sometimes includes JPEG. Why (http://www.qtcentre.org/forum/f-installation-and-deployment-5/t-qimagewriter-supportedimageformats-only-sometimes-includes-jpeg-why-17633-post87899.html)?
http://www.qtcentre.org/forum/f-installation-and-deployment-5/t-qimagewriter-supportedimageformats-only-sometimes-includes-jpeg-why-17633-post87899.html
In particular, the problem is addressed within this FAQ:
http://www.qtcentre.org/forum/faq.php?faq=qt_general_category#faq_qt_missing_ima ges
You probably didn't deploy image plugins with your application. You need to copy the contents of plugins/imageformats directory of your Qt installation to the imageformats subdirectory of the directory where you deployed the application binary.
For instance if you deployed the application to C:\Program Files\MyApp, you need to copy the plugins to C:\Program Files\MyApp\imageformats.
Imageformat plugins are libraries called "qjpeg", "qsvg", "qtiff", etc.
Terabyte
5th January 2009, 19:15
Thanks. that worked a charm
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.