The QImageIO class contains parameters for loading and saving images.
.PP
QImageIO contains a QIODevice object that is used for image data I/O. The programmer can install new image file formats in addition to those that Qt provides.
.PP
Qt currently supports the following image file formats: PNG, BMP, XBM, XPM and PNM. It may also support JPEG, MNG and GIF, if specially configured during compilation. The different PNM formats are: PBM (P1 or P4), PGM (P2 or P5), and PPM (P3 or P6).
.PP
You don't normally need to use this class; QPixmap::load(), QPixmap::save(), and QImage contain sufficient functionality.
.PP
For image files that contain sequences of images, only the first is read. See QMovie for loading multiple images.
.PP
PBM, PGM, and PPM format \fIoutput\fR is always in the more condensed raw format. PPM and PGM files with more than 256 levels of intensity are scaled down when reading.
\fBWarning:\fR If you are in a country which recognizes software patents and in which Unisys holds a patent on LZW compression and/or decompression and you want to use GIF, Unisys may require you to license the technology. Such countries include Canada, Japan, the USA, France, Germany, Italy and the UK.
Defines an image I/O handler for the image format called \fIformat\fR, which is recognized using the regular expression \fIheader\fR, read using \fIreadImage\fR and written using \fIwriteImage\fR.
.PP
\fIflags\fR is a string of single-character flags for this format. The only flag defined currently is T (upper case), so the only legal value for \fIflags\fR are "T" and the empty string. The "T" flag means that the image file is a text file, and Qt should treat all newline conventions as equivalent. (XPM files and some PPM files are text files for example.)
.PP
\fIformat\fR is used to select a handler to write a QImage; \fIheader\fR is used to select a handler to read an image file.
.PP
If \fIreadImage\fR is a null pointer, the QImageIO will not be able to read images in \fIformat\fR. If \fIwriteImage\fR is a null pointer, the QImageIO will not be able to write images in \fIformat\fR. If both are null, the QImageIO object is valid but useless.
.PP
Example:
.PP
.nf
.br
void readGIF( QImageIO *image )
.br
{
.br
// read the image using the image->ioDevice()
.br
}
.br
.br
void writeGIF( QImageIO *image )
.br
{
.br
// write the image using the image->ioDevice()
.br
}
.br
.br
// add the GIF image handler
.br
.br
QImageIO::defineIOHandler( "GIF",
.br
"^GIF[0-9][0-9][a-z]",
.br
0,
.br
readGIF,
.br
writeGIF );
.br
.fi
.PP
Before the regex test, all the 0 bytes in the file header are converted to 1 bytes. This is done because when Qt was ASCII-based, QRegExp could not handle 0 bytes in strings.
.PP
The regexp is only applied on the first 14 bytes of the file.
.PP
Note that Qt assumes that there is only one handler per format; if two handlers support the same format, Qt will choose one arbitrarily. It is not possible to have one handler support reading, and another support writing.
.SH "QString QImageIO::description () const"
Returns the image description string.
.PP
See also setDescription().
.SH "QString QImageIO::fileName () const"
Returns the file name currently set.
.PP
See also setFileName().
.SH "const char * QImageIO::format () const"
Returns the image format string or 0 if no format has been explicitly set.
.SH "float QImageIO::gamma () const"
Returns the gamma value at which the image will be viewed.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns a string that specifies the image format of the image read from IO device \fId\fR, or 0 if the device cannot be read or if the format is not recognized.
.PP
Make sure that \fId\fR is at the right position in the device (for example, at the beginning of the file).
Sets the name of the file to read or write an image from to \fIfileName\fR.
.PP
See also setIODevice().
.SH "void QImageIO::setFormat ( const char * format )"
Sets the image format to \fIformat\fR for the image to be read or written.
.PP
It is necessary to specify a format before writing an image, but it is not necessary to specify a format before reading an image.
.PP
If no format has been set, Qt guesses the image format before reading it. If a format is set the image will only be read if it has that format.
.PP
See also read(), write(), and format().
.SH "void QImageIO::setGamma ( float gamma )"
Sets the gamma value at which the image will be viewed to \fIgamma\fR. If the image format stores a gamma value for which the image is intended to be used, then this setting will be used to modify the image. Setting to 0.0 will disable gamma correction (i.e. any specification in the file will be ignored).
Although the current image formats supported by Qt ignore the parameters string, it may be used in future extensions or by contributions (for example, JPEG).
.PP
See also parameters().
.SH "void QImageIO::setQuality ( int q )"
Sets the quality of the written image to \fIq\fR, related to the compression ratio.
.PP
\fIq\fR must be in the range -1..100. Specify 0 to obtain small compressed files, 100 for large uncompressed files. (-1 signifies the default compression.)
.PP
See also quality() and QImage::save().
.SH "void QImageIO::setStatus ( int status )"
Sets the image IO status to \fIstatus\fR. A non-zero value indicates an error, whereas 0 means that the IO operation was successful.
.PP
See also status().
.SH "int QImageIO::status () const"
Returns the image's IO status. A non-zero value indicates an error, whereas 0 means that the IO operation was successful.
.PP
See also setStatus().
.SH "bool QImageIO::write ()"
Writes an image to an IO device and returns TRUE if the image was successfully written; otherwise returns FALSE.
.PP
Before writing an image you must set an IO device or a file name. If both an IO device and a file name have been set, the IO device will be used.
.PP
The image will be written using the specified image format.
.PP
Example:
.PP
.nf
.br
QImageIO iio;
.br
QImage im;
.br
im = pixmap; // convert to image
.br
iio.setImage( im );
.br
iio.setFileName( "vegeburger.bmp" );
.br
iio.setFormat( "BMP" );
.br
if ( iio.write() )
.br
// returned TRUE if written successfully
.br
.fi
.PP
See also setIODevice(), setFileName(), setFormat(), read(), and QPixmap::save().
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qimageio.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (qimageio.3qt) and the Qt