|  | Home · Overviews · Examples |

# QImageWriter Class Reference
[com.trolltech.qt.gui module]

The `QImageWriter` class provides a format independent interface for writing images to files or other devices. More...

## Detailed Description

The `QImageWriter` class provides a format independent interface for writing images to files or other devices.

`QImageWriter` supports setting format specific options, such as the gamma level, compression level and quality, prior to storing the image. If you do not need such options, you can use QImage::save() or QPixmap::save() instead.

To store an image, you start by constructing a `QImageWriter` object. Pass either a file name or a device pointer, and the image format to `QImageWriter`'s constructor. You can then set several options, such as the gamma level (by calling `setGamma`) and quality (by calling `setQuality`). `canWrite` returns true if `QImageWriter` can write the image (i.e., the image format is supported and the device is open for writing). Call `write` to write the image to the device.

If any error occurs when writing the image, `write` will return false. You can then call `error` to find the type of error that occurred, or `errorString` to get a human readable description of what went wrong.

Call `supportedImageFormats` for a list of formats that `QImageWriter` can write. `QImageWriter` supports all built-in image formats, in addition to any image format plugins that support writing.

See also `QImageReader`, `QImageIOHandler`, and `QImageIOPlugin`.