1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QImageReader Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QImageReader Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QImageReader class provides a format independent interface for reading images from files or other devices. <a href="#details">More...</a></p>
<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qimagereader.html#ImageReaderError-enum">ImageReaderError</a></b> { UnknownError, FileNotFoundError, DeviceError, UnsupportedFormatError, InvalidDataError }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qimagereader.html#QImageReader">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qimagereader.html#QImageReader-2">__init__</a></b> (<i>self</i>, QIODevice <i>device</i>, QByteArray <i>format</i> = QByteArray())</li><li><div class="fn" /><b><a href="qimagereader.html#QImageReader-3">__init__</a></b> (<i>self</i>, QString <i>fileName</i>, QByteArray <i>format</i> = QByteArray())</li><li><div class="fn" />QColor <b><a href="qimagereader.html#backgroundColor">backgroundColor</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qimagereader.html#canRead">canRead</a></b> (<i>self</i>)</li><li><div class="fn" />QRect <b><a href="qimagereader.html#clipRect">clipRect</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qimagereader.html#currentImageNumber">currentImageNumber</a></b> (<i>self</i>)</li><li><div class="fn" />QRect <b><a href="qimagereader.html#currentImageRect">currentImageRect</a></b> (<i>self</i>)</li><li><div class="fn" />QIODevice <b><a href="qimagereader.html#device">device</a></b> (<i>self</i>)</li><li><div class="fn" />ImageReaderError <b><a href="qimagereader.html#error">error</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qimagereader.html#errorString">errorString</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qimagereader.html#fileName">fileName</a></b> (<i>self</i>)</li><li><div class="fn" />QByteArray <b><a href="qimagereader.html#format">format</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qimagereader.html#imageCount">imageCount</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qimagereader.html#jumpToImage">jumpToImage</a></b> (<i>self</i>, int <i>imageNumber</i>)</li><li><div class="fn" />bool <b><a href="qimagereader.html#jumpToNextImage">jumpToNextImage</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qimagereader.html#loopCount">loopCount</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qimagereader.html#nextImageDelay">nextImageDelay</a></b> (<i>self</i>)</li><li><div class="fn" />QImage <b><a href="qimagereader.html#read">read</a></b> (<i>self</i>)</li><li><div class="fn" />QRect <b><a href="qimagereader.html#scaledClipRect">scaledClipRect</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qimagereader.html#scaledSize">scaledSize</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qimagereader.html#setBackgroundColor">setBackgroundColor</a></b> (<i>self</i>, QColor <i>color</i>)</li><li><div class="fn" /><b><a href="qimagereader.html#setClipRect">setClipRect</a></b> (<i>self</i>, QRect <i>rect</i>)</li><li><div class="fn" /><b><a href="qimagereader.html#setDevice">setDevice</a></b> (<i>self</i>, QIODevice <i>device</i>)</li><li><div class="fn" /><b><a href="qimagereader.html#setFileName">setFileName</a></b> (<i>self</i>, QString <i>fileName</i>)</li><li><div class="fn" /><b><a href="qimagereader.html#setFormat">setFormat</a></b> (<i>self</i>, QByteArray <i>format</i>)</li><li><div class="fn" /><b><a href="qimagereader.html#setScaledClipRect">setScaledClipRect</a></b> (<i>self</i>, QRect <i>rect</i>)</li><li><div class="fn" /><b><a href="qimagereader.html#setScaledSize">setScaledSize</a></b> (<i>self</i>, QSize <i>size</i>)</li><li><div class="fn" />QSize <b><a href="qimagereader.html#size">size</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qimagereader.html#supportsAnimation">supportsAnimation</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qimagereader.html#text">text</a></b> (<i>self</i>, QString <i>key</i>)</li><li><div class="fn" />QStringList <b><a href="qimagereader.html#textKeys">textKeys</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QByteArray <b><a href="qimagereader.html#imageFormat">imageFormat</a></b> (QString <i>fileName</i>)</li><li><div class="fn" />QByteArray <b><a href="qimagereader.html#imageFormat-2">imageFormat</a></b> (QIODevice <i>device</i>)</li><li><div class="fn" />QByteArray-list <b><a href="qimagereader.html#supportedImageFormats">supportedImageFormats</a></b> ()</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QImageReader class provides a format independent interface for reading images from files or other devices.</p>
<p>The most common way to read images is through <a href="qimage.html">QImage</a> and <a href="qpixmap.html">QPixmap</a>'s constructors, or by calling <a href="qimage.html#load">QImage.load</a>() and <a href="qpixmap.html#load">QPixmap.load</a>(). QImageReader is a specialized class which gives you more control when reading images. For example, you can read an image into a specific size by calling <a href="qimagereader.html#setScaledSize">setScaledSize</a>(), and you can select a clip rect, effectively loading only parts of an image, by calling <a href="qimagereader.html#setClipRect">setClipRect</a>(). Depending on the underlying support in the image format, this can save memory and speed up loading of images.</p>
<p>To read an image, you start by constructing a QImageReader object. Pass either a file name or a device pointer, and the image format to QImageReader's constructor. You can then set several options, such as the clip rect (by calling <a href="qimagereader.html#setClipRect">setClipRect</a>()) and scaled size (by calling <a href="qimagereader.html#setScaledSize">setScaledSize</a>()). <a href="qimagereader.html#canRead">canRead</a>() returns the image if the QImageReader can read the image (i.e., the image format is supported and the device is open for reading). Call <a href="qimagereader.html#read">read</a>() to read the image.</p>
<p>If any error occurs when reading the image, <a href="qimagereader.html#read">read</a>() will return a null <a href="qimage.html">QImage</a>. You can then call <a href="qimagereader.html#error">error</a>() to find the type of error that occurred, or <a href="qimagereader.html#errorString">errorString</a>() to get a human readable description of what went wrong.</p>
<p>Call <a href="qimagereader.html#supportedImageFormats">supportedImageFormats</a>() for a list of formats that QImageReader can read. QImageReader supports all built-in image formats, in addition to any image format plugins that support reading.</p>
<p>Qt supports GIF reading if it is configured that way during installation. If it is, we are required to state that "The Graphics Interchange Format(c) is the Copyright property of CompuServe Incorporated. GIF(sm) is a Service Mark property of CompuServe Incorporated."</p>
<p><b>Warning:</b> If you are in a country that 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 that technology. Such countries include Canada, Japan, the US, France, Germany, Italy and the UK.</p>
<p>GIF support may be removed completely in a future version of Qt. We recommend using the MNG or PNG format.</p>
<p>See also <a href="qimagewriter.html">QImageWriter</a>, <a href="qimageiohandler.html">QImageIOHandler</a>, and <a href="qimageioplugin.html">QImageIOPlugin</a>.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="ImageReaderError-enum" />QImageReader.ImageReaderError</h3><p>This enum describes the different types of errors that can occur when reading images with <a href="qimagereader.html">QImageReader</a>.</p>
<table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr>
<th width="25%">Constant</th>
<th width="15%">Value</th>
<th width="60%">Description</th>
</tr>
<tr>
<td valign="top"><tt>QImageReader.FileNotFoundError</tt></td>
<td align="center" valign="top"><tt>1</tt></td>
<td valign="top"><a href="qimagereader.html">QImageReader</a> was used with a file name, but not file was found with that name. This can also happen if the file name contained no extension, and the file with the correct extension is not supported by Qt.</td>
</tr>
<tr>
<td valign="top"><tt>QImageReader.DeviceError</tt></td>
<td align="center" valign="top"><tt>2</tt></td>
<td valign="top"><a href="qimagereader.html">QImageReader</a> encountered a device error when reading the image. You can consult your particular device for more details on what went wrong.</td>
</tr>
<tr>
<td valign="top"><tt>QImageReader.UnsupportedFormatError</tt></td>
<td align="center" valign="top"><tt>3</tt></td>
<td valign="top">Qt does not support the requested image format.</td>
</tr>
<tr>
<td valign="top"><tt>QImageReader.InvalidDataError</tt></td>
<td align="center" valign="top"><tt>4</tt></td>
<td valign="top">The image data was invalid, and <a href="qimagereader.html">QImageReader</a> was unable to read an image from it. The can happen if the image file is damaged.</td>
</tr>
<tr>
<td valign="top"><tt>QImageReader.UnknownError</tt></td>
<td align="center" valign="top"><tt>0</tt></td>
<td valign="top">An unknown error occurred. If you get this value after calling <a href="qimagereader.html#read">read</a>(), it is most likely caused by a bug in <a href="qimagereader.html">QImageReader</a>.</td>
</tr>
</table>
<br />
<br />
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QImageReader" />QImageReader.__init__ (<i>self</i>)</h3><p>Constructs an empty <a href="qimagereader.html">QImageReader</a> object. Before reading an image, call <a href="qimagereader.html#setDevice">setDevice</a>() or <a href="qimagereader.html#setFileName">setFileName</a>().</p>
<h3 class="fn"><a name="QImageReader-2" />QImageReader.__init__ (<i>self</i>, <a href="qiodevice.html">QIODevice</a> <i>device</i>, <a href="qbytearray.html">QByteArray</a> <i>format</i> = QByteArray())</h3><p>Constructs a <a href="qimagereader.html">QImageReader</a> object with the device <i>device</i> and the image format <i>format</i>.</p>
<h3 class="fn"><a name="QImageReader-3" />QImageReader.__init__ (<i>self</i>, <a href="qstring.html">QString</a> <i>fileName</i>, <a href="qbytearray.html">QByteArray</a> <i>format</i> = QByteArray())</h3><p>Constructs a <a href="qimagereader.html">QImageReader</a> object with the file name <i>fileName</i> and the image format <i>format</i>.</p>
<p>See also <a href="qimagereader.html#setFileName">setFileName</a>().</p>
<h3 class="fn"><a name="backgroundColor" /><a href="qcolor.html">QColor</a> QImageReader.backgroundColor (<i>self</i>)</h3><p>Returns the background color that's used when reading an image. If the image format does not support setting the background color an invalid color is returned.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qimagereader.html#setBackgroundColor">setBackgroundColor</a>() and <a href="qimagereader.html#read">read</a>().</p>
<h3 class="fn"><a name="canRead" />bool QImageReader.canRead (<i>self</i>)</h3><p>Returns true if an image can be read for the device (i.e., the image format is supported, and the device seems to contain valid data); otherwise returns false.</p>
<p>canRead() is a lightweight function that only does a quick test to see if the image data is valid. <a href="qimagereader.html#read">read</a>() may still return false after canRead() returns true, if the image data is corrupt.</p>
<p>For images that support animation, canRead() returns false when all frames have been read.</p>
<p>See also <a href="qimagereader.html#read">read</a>() and <a href="qimagereader.html#supportedImageFormats">supportedImageFormats</a>().</p>
<h3 class="fn"><a name="clipRect" /><a href="qrect.html">QRect</a> QImageReader.clipRect (<i>self</i>)</h3><p>Returns the clip rect (also known as the ROI, or Region Of Interest) of the image. If no clip rect has been set, an invalid <a href="qrect.html">QRect</a> is returned.</p>
<p>See also <a href="qimagereader.html#setClipRect">setClipRect</a>().</p>
<h3 class="fn"><a name="currentImageNumber" />int QImageReader.currentImageNumber (<i>self</i>)</h3><p>For image formats that support animation, this function returns the sequence number of the current frame. Otherwise, -1 is returned.</p>
<p>See also <a href="qimagereader.html#supportsAnimation">supportsAnimation</a>() and <a href="qimageiohandler.html#currentImageNumber">QImageIOHandler.currentImageNumber</a>().</p>
<h3 class="fn"><a name="currentImageRect" /><a href="qrect.html">QRect</a> QImageReader.currentImageRect (<i>self</i>)</h3><p>For image formats that support animation, this function returns the rect for the current frame. Otherwise, a null rect is returned.</p>
<p>See also <a href="qimagereader.html#supportsAnimation">supportsAnimation</a>() and <a href="qimageiohandler.html#currentImageRect">QImageIOHandler.currentImageRect</a>().</p>
<h3 class="fn"><a name="device" /><a href="qiodevice.html">QIODevice</a> QImageReader.device (<i>self</i>)</h3><p>Returns the device currently assigned to <a href="qimagereader.html">QImageReader</a>, or 0 if no device has been assigned.</p>
<p>See also <a href="qimagereader.html#setDevice">setDevice</a>().</p>
<h3 class="fn"><a name="error" /><a href="qimagereader.html#ImageReaderError-enum">ImageReaderError</a> QImageReader.error (<i>self</i>)</h3><p>Returns the type of error that occurred last.</p>
<p>See also <a href="qimagereader.html#ImageReaderError-enum">ImageReaderError</a> and <a href="qimagereader.html#errorString">errorString</a>().</p>
<h3 class="fn"><a name="errorString" /><a href="qstring.html">QString</a> QImageReader.errorString (<i>self</i>)</h3><p>Returns a human readable description of the last error that occurred.</p>
<p>See also <a href="qimagereader.html#error">error</a>().</p>
<h3 class="fn"><a name="fileName" /><a href="qstring.html">QString</a> QImageReader.fileName (<i>self</i>)</h3><p>If the currently assigned device is a <a href="qfile.html">QFile</a>, or if <a href="qimagereader.html#setFileName">setFileName</a>() has been called, this function returns the name of the file <a href="qimagereader.html">QImageReader</a> reads from. Otherwise (i.e., if no device has been assigned or the device is not a <a href="qfile.html">QFile</a>), an empty <a href="qstring.html">QString</a> is returned.</p>
<p>See also <a href="qimagereader.html#setFileName">setFileName</a>() and <a href="qimagereader.html#setDevice">setDevice</a>().</p>
<h3 class="fn"><a name="format" /><a href="qbytearray.html">QByteArray</a> QImageReader.format (<i>self</i>)</h3><p>Returns the format <a href="qimagereader.html">QImageReader</a> uses for reading images.</p>
<p>See also <a href="qimagereader.html#setFormat">setFormat</a>().</p>
<h3 class="fn"><a name="imageCount" />int QImageReader.imageCount (<i>self</i>)</h3><p>For image formats that support animation, this function returns the total number of images in the animation.</p>
<p>Certain animation formats do not support this feature, in which case 0 is returned.</p>
<p>See also <a href="qimagereader.html#supportsAnimation">supportsAnimation</a>() and <a href="qimageiohandler.html#imageCount">QImageIOHandler.imageCount</a>().</p>
<h3 class="fn"><a name="imageFormat" /><a href="qbytearray.html">QByteArray</a> QImageReader.imageFormat (<a href="qstring.html">QString</a> <i>fileName</i>)</h3><p>If supported, this function returns the image format of the file <i>fileName</i>. Otherwise, an empty string is returned.</p>
<h3 class="fn"><a name="imageFormat-2" /><a href="qbytearray.html">QByteArray</a> QImageReader.imageFormat (<a href="qiodevice.html">QIODevice</a> <i>device</i>)</h3><p>This is an overloaded member function, provided for convenience.</p>
<p>If supported, this function returns the image format of the device <i>device</i>. Otherwise, an empty string is returned.</p>
<h3 class="fn"><a name="jumpToImage" />bool QImageReader.jumpToImage (<i>self</i>, int <i>imageNumber</i>)</h3><p>For image formats that support animation, this function skips to the image whose sequence number is <i>imageNumber</i>. The next call to <a href="qimagereader.html#read">read</a>() will attempt to read this image.</p>
<p>See also <a href="qimagereader.html#jumpToNextImage">jumpToNextImage</a>() and <a href="qimageiohandler.html#jumpToImage">QImageIOHandler.jumpToImage</a>().</p>
<h3 class="fn"><a name="jumpToNextImage" />bool QImageReader.jumpToNextImage (<i>self</i>)</h3><p>For image formats that support animation, this function steps over the current image.</p>
<p>The default implementation calls <a href="qimagereader.html#read">read</a>(), and then discards the resulting image, but the image handler may have a more efficient way of implementing this operation.</p>
<p>See also <a href="qimagereader.html#jumpToImage">jumpToImage</a>() and <a href="qimageiohandler.html#jumpToNextImage">QImageIOHandler.jumpToNextImage</a>().</p>
<h3 class="fn"><a name="loopCount" />int QImageReader.loopCount (<i>self</i>)</h3><p>For image formats that support animation, this function returns the number of times the animation should loop. Otherwise, it returns -1.</p>
<p>See also <a href="qimagereader.html#supportsAnimation">supportsAnimation</a>() and <a href="qimageiohandler.html#loopCount">QImageIOHandler.loopCount</a>().</p>
<h3 class="fn"><a name="nextImageDelay" />int QImageReader.nextImageDelay (<i>self</i>)</h3><p>For image formats that support animation, this function returns the number of milliseconds to wait until displaying the next frame in the animation. Otherwise, 0 is returned.</p>
<p>See also <a href="qimagereader.html#supportsAnimation">supportsAnimation</a>() and <a href="qimageiohandler.html#nextImageDelay">QImageIOHandler.nextImageDelay</a>().</p>
<h3 class="fn"><a name="read" /><a href="qimage.html">QImage</a> QImageReader.read (<i>self</i>)</h3><p>Reads an image from the device. On success, the image that was read is returned; otherwise, a null <a href="qimage.html">QImage</a> is returned. You can then call <a href="qimagereader.html#error">error</a>() to find the type of error that occurred, or <a href="qimagereader.html#errorString">errorString</a>() to get a human readable description of the error.</p>
<p>For image formats that support animation, calling read() repeatedly will return the next frame. When all frames have been read, a null image will be returned.</p>
<p>See also <a href="qimagereader.html#canRead">canRead</a>(), <a href="qimagereader.html#supportedImageFormats">supportedImageFormats</a>(), <a href="qimagereader.html#supportsAnimation">supportsAnimation</a>(), and <a href="qmovie.html">QMovie</a>.</p>
<h3 class="fn"><a name="scaledClipRect" /><a href="qrect.html">QRect</a> QImageReader.scaledClipRect (<i>self</i>)</h3><p>Returns the scaled clip rect of the image.</p>
<p>See also <a href="qimagereader.html#setScaledClipRect">setScaledClipRect</a>().</p>
<h3 class="fn"><a name="scaledSize" /><a href="qsize.html">QSize</a> QImageReader.scaledSize (<i>self</i>)</h3><p>Returns the scaled size of the image.</p>
<p>See also <a href="qimagereader.html#setScaledSize">setScaledSize</a>().</p>
<h3 class="fn"><a name="setBackgroundColor" />QImageReader.setBackgroundColor (<i>self</i>, <a href="qcolor.html">QColor</a> <i>color</i>)</h3><p>Sets the background color to <i>color</i>. Image formats that support this operation are expected to initialize the background to <i>color</i> before reading an image.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qimagereader.html#backgroundColor">backgroundColor</a>() and <a href="qimagereader.html#read">read</a>().</p>
<h3 class="fn"><a name="setClipRect" />QImageReader.setClipRect (<i>self</i>, <a href="qrect.html">QRect</a> <i>rect</i>)</h3><p>Sets the image clip rect (also known as the ROI, or Region Of Interest) to <i>rect</i>. The coordinates of <i>rect</i> are relative to the untransformed image size, as returned by <a href="qimagereader.html#size">size</a>().</p>
<p>See also <a href="qimagereader.html#clipRect">clipRect</a>(), <a href="qimagereader.html#setScaledSize">setScaledSize</a>(), and <a href="qimagereader.html#setScaledClipRect">setScaledClipRect</a>().</p>
<h3 class="fn"><a name="setDevice" />QImageReader.setDevice (<i>self</i>, <a href="qiodevice.html">QIODevice</a> <i>device</i>)</h3><p>Sets <a href="qimagereader.html">QImageReader</a>'s device to <i>device</i>. If a device has already been set, the old device is removed from <a href="qimagereader.html">QImageReader</a> and is otherwise left unchanged.</p>
<p>If the device is not already open, <a href="qimagereader.html">QImageReader</a> will attempt to open the device in <a href="qiodevice.html#OpenModeFlag-enum">QIODevice.ReadOnly</a> mode by calling open(). Note that this does not work for certain devices, such as <a href="qprocess.html">QProcess</a>, <a href="qtcpsocket.html">QTcpSocket</a> and <a href="qudpsocket.html">QUdpSocket</a>, where more logic is required to open the device.</p>
<p>See also <a href="qimagereader.html#device">device</a>() and <a href="qimagereader.html#setFileName">setFileName</a>().</p>
<h3 class="fn"><a name="setFileName" />QImageReader.setFileName (<i>self</i>, <a href="qstring.html">QString</a> <i>fileName</i>)</h3><p>Sets the file name of <a href="qimagereader.html">QImageReader</a> to <i>fileName</i>. Internally, <a href="qimagereader.html">QImageReader</a> will create a <a href="qfile.html">QFile</a> object and open it in <a href="qiodevice.html#OpenModeFlag-enum">QIODevice.ReadOnly</a> mode, and use this when reading images.</p>
<p>If <i>fileName</i> does not include a file extension (e.g., .png or .bmp), <a href="qimagereader.html">QImageReader</a> will cycle through all supported extensions until it finds a matching file.</p>
<p>See also <a href="qimagereader.html#fileName">fileName</a>(), <a href="qimagereader.html#setDevice">setDevice</a>(), and <a href="qimagereader.html#supportedImageFormats">supportedImageFormats</a>().</p>
<h3 class="fn"><a name="setFormat" />QImageReader.setFormat (<i>self</i>, <a href="qbytearray.html">QByteArray</a> <i>format</i>)</h3><p>Sets the format <a href="qimagereader.html">QImageReader</a> will use when reading images, to <i>format</i>. <i>format</i> is a case insensitive text string. Example:</p>
<pre>
QImageReader reader;
reader.setFormat("png"); // same as reader.setFormat("PNG");
</pre>
<p>You can call <a href="qimagereader.html#supportedImageFormats">supportedImageFormats</a>() for the full list of formats <a href="qimagereader.html">QImageReader</a> supports.</p>
<p>See also <a href="qimagereader.html#format">format</a>().</p>
<h3 class="fn"><a name="setScaledClipRect" />QImageReader.setScaledClipRect (<i>self</i>, <a href="qrect.html">QRect</a> <i>rect</i>)</h3><p>Sets the scaled clip rect to <i>rect</i>. The scaled clip rect is the clip rect (also known as ROI, or Region Of Interest) that is applied after the image has been scaled.</p>
<p>See also <a href="qimagereader.html#scaledClipRect">scaledClipRect</a>() and <a href="qimagereader.html#setScaledSize">setScaledSize</a>().</p>
<h3 class="fn"><a name="setScaledSize" />QImageReader.setScaledSize (<i>self</i>, <a href="qsize.html">QSize</a> <i>size</i>)</h3><p>Sets the scaled size of the image to <i>size</i>. The scaling is performed after the initial clip rect, but before the scaled clip rect is applied. The algorithm used for scaling depends on the image format. By default (i.e., if the image format does not support scaling), <a href="qimagereader.html">QImageReader</a> will use QImage.scale() with Qt.SmoothScaling.</p>
<p>See also <a href="qimagereader.html#scaledSize">scaledSize</a>(), <a href="qimagereader.html#setClipRect">setClipRect</a>(), and <a href="qimagereader.html#setScaledClipRect">setScaledClipRect</a>().</p>
<h3 class="fn"><a name="size" /><a href="qsize.html">QSize</a> QImageReader.size (<i>self</i>)</h3><p>Returns the size of the image. This function may or may not read the entire image, depending on whether the image format supports checking the size of an image before loading it.</p>
<h3 class="fn"><a name="supportedImageFormats" />QByteArray-list QImageReader.supportedImageFormats ()</h3><p>Returns the list of image formats supported by <a href="qimagereader.html">QImageReader</a>.</p>
<p>By default, Qt can read the following formats:</p>
<table align="center" border="0" cellpadding="2" cellspacing="1">
<tr bgcolor="#A2C511" valign="top">
<th>Format</th>
<th>Description</th>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>BMP</td>
<td>Windows Bitmap</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>GIF</td>
<td>Graphic Interchange Format (optional)</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>JPG</td>
<td>Joint Photographic Experts Group</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>JPEG</td>
<td>Joint Photographic Experts Group</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>MNG</td>
<td>Multiple-image Network Graphics</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>PNG</td>
<td>Portable Network Graphics</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>PBM</td>
<td>Portable Bitmap</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>PGM</td>
<td>Portable Graymap</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>PPM</td>
<td>Portable Pixmap</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>XBM</td>
<td>X11 Bitmap</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>XPM</td>
<td>X11 Pixmap</td>
</tr>
</table>
<br />
<br />
<p>To configure Qt with GIF support, pass <tt>-qt-gif</tt> to the <tt>configure</tt> script or check the appropriate option in the graphical installer.</p>
<p>See also <a href="qimagereader.html#setFormat">setFormat</a>(), <a href="qimagewriter.html#supportedImageFormats">QImageWriter.supportedImageFormats</a>(), and <a href="qimageioplugin.html">QImageIOPlugin</a>.</p>
<h3 class="fn"><a name="supportsAnimation" />bool QImageReader.supportsAnimation (<i>self</i>)</h3><p>Returns true if the image format supports animation; otherwise, false is returned.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qmovie.html#supportedFormats">QMovie.supportedFormats</a>().</p>
<h3 class="fn"><a name="text" /><a href="qstring.html">QString</a> QImageReader.text (<i>self</i>, <a href="qstring.html">QString</a> <i>key</i>)</h3><p>Returns the image text associated with <i>key</i>.</p>
<p>Support for this option is implemented through <a href="qimageiohandler.html#ImageOption-enum">QImageIOHandler.Description</a>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qimagereader.html#textKeys">textKeys</a>() and <a href="qimagewriter.html#setText">QImageWriter.setText</a>().</p>
<h3 class="fn"><a name="textKeys" /><a href="qstringlist.html">QStringList</a> QImageReader.textKeys (<i>self</i>)</h3><p>Returns the text keys for this image. You can use these keys with <a href="qimagereader.html#text">text</a>() to list the image text for a certain key.</p>
<p>Support for this option is implemented through <a href="qimageiohandler.html#ImageOption-enum">QImageIOHandler.Description</a>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qimagereader.html#text">text</a>(), <a href="qimagewriter.html#setText">QImageWriter.setText</a>(), and <a href="qimage.html#textKeys">QImage.textKeys</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt 4.0.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.trolltech.com">Trolltech AS</a> 2006</td><td align="right" width="25%">Qt 4.1.4</td></tr></table></div></address></body></html>
|