Pretty simple question .. Are there any predefined functions in Qt which save a QImage object to a JPG/PNG/BMP file ?
views:
59answers:
2[Qt/C++] Are there any predefined functions in Qt which save a QImage object to a JPG/PNG/BMP file ?
This is exactly what you'll need:
http://doc.trolltech.com/4.6/qimage.html#reading-and-writing-image-files
Google is your friend, but more so are the Qt docs.
The best way is to use QImageReader/QImageWriter. They provide more ability to work with images in comparison to QImage or QPixmap http://doc.qt.nokia.com/4.6/qimagewriter.html http://doc.qt.nokia.com/4.6/qimagereader.html
"QImageReader is specialized class which gives you more control when reading images. For example, you can read an image into a specific size by calling setScaledSize(), and you can select a clip rect, effectively loading only parts of an image, by calling setClipRect(). Depending on the underlying support in the image format, this can save memory and speed up loading of images"
"QImageWriter supports setting format specific options, such as the gamma level, compression level and quality, prior to storing the image"