Animesh Karnewar
Animesh Karnewar

Reputation: 436

Save a QImage in Qt

Is it possible to export images generated in Qt creator? The qimage which is a built in data type in Qt. We modify it using setpixel() function. I want to save that image for further use.

Upvotes: 2

Views: 21853

Answers (1)

Thomas Ayoub
Thomas Ayoub

Reputation: 29431

You can use

bool QImage::save ( const QString & fileName, const char * format = 0, int quality = -1 ) const

To save your QImage

Saves the image to the file with the given fileName, using the given image file format and quality factor. If format is 0, QImage will attempt to guess the format by looking at fileName's suffix.

The quality factor must be in the range 0 to 100 or -1. Specify 0 to obtain small compressed files, 100 for large uncompressed files, and -1 (the default) to use the default settings.

Returns true if the image was successfully saved; otherwise returns false.

Upvotes: 15

Related Questions