在 Qt 中保存一个 QImage
Save a QImage in Qt
是否可以导出在Qt creator 中生成的图像? qimage 是 Qt 中的内置数据类型。我们使用 setpixel()
函数对其进行修改。我想保存该图像以供进一步使用。
您可以使用
bool QImage::save ( const QString & fileName, const char * format = 0, int quality = -1 ) const
保存你的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.
是否可以导出在Qt creator 中生成的图像? qimage 是 Qt 中的内置数据类型。我们使用 setpixel()
函数对其进行修改。我想保存该图像以供进一步使用。
您可以使用
bool QImage::save ( const QString & fileName, const char * format = 0, int quality = -1 ) const
保存你的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.