QPictureIO¶
The
QPictureIO
class contains parameters for loading and saving pictures. More…
Synopsis¶
Functions¶
def
description
()def
fileName
()def
format
()def
gamma
()def
ioDevice
()def
parameters
()def
picture
()def
quality
()def
read
()def
setDescription
(arg__1)def
setFileName
(arg__1)def
setFormat
(arg__1)def
setGamma
(arg__1)def
setIODevice
(arg__1)def
setParameters
(arg__1)def
setPicture
(arg__1)def
setQuality
(arg__1)def
setStatus
(arg__1)def
status
()def
write
()
Static functions¶
def
inputFormats
()def
outputFormats
()def
pictureFormat
(arg__1)def
pictureFormat
(fileName)
Detailed Description¶
-
class
QPictureIO
¶ QPictureIO(ioDevice, format)
QPictureIO(fileName, format)
- param format
str
- param fileName
unicode
- param ioDevice
QIODevice
Constructs a
QPictureIO
object with all parameters set to zero.Constructs a
QPictureIO
object with the I/O deviceioDevice
and aformat
tag.
-
PySide2.QtGui.QPictureIO.
description
()¶ - Return type
unicode
Returns the picture description string.
See also
-
PySide2.QtGui.QPictureIO.
fileName
()¶ - Return type
unicode
Returns the file name currently set.
See also
-
PySide2.QtGui.QPictureIO.
format
()¶ - Return type
str
Returns the picture format string or 0 if no format has been explicitly set.
See also
-
PySide2.QtGui.QPictureIO.
gamma
()¶ - Return type
float
Returns the gamma value at which the picture will be viewed.
See also
-
static
PySide2.QtGui.QPictureIO.
inputFormats
()¶ - Return type
Returns a sorted list of picture formats that are supported for picture input.
-
PySide2.QtGui.QPictureIO.
ioDevice
()¶ - Return type
QIODevice
Returns the IO device currently set.
See also
-
static
PySide2.QtGui.QPictureIO.
outputFormats
()¶ - Return type
Returns a sorted list of picture formats that are supported for picture output.
-
PySide2.QtGui.QPictureIO.
parameters
()¶ - Return type
str
Returns the picture’s parameters string.
See also
-
PySide2.QtGui.QPictureIO.
picture
()¶ - Return type
Returns the picture currently set.
See also
-
static
PySide2.QtGui.QPictureIO.
pictureFormat
(fileName)¶ - Parameters
fileName – unicode
- Return type
QByteArray
-
static
PySide2.QtGui.QPictureIO.
pictureFormat
(arg__1) - Parameters
arg__1 –
QIODevice
- Return type
QByteArray
This is an overloaded function.
Returns a string that specifies the picture format of the picture read from IO device
d
, or 0 if the device cannot be read or if the format is not recognized.Make sure that
d
is at the right position in the device (for example, at the beginning of the file).See also
pos()
-
PySide2.QtGui.QPictureIO.
quality
()¶ - Return type
int
Returns the quality of the written picture, related to the compression ratio.
See also
-
PySide2.QtGui.QPictureIO.
read
()¶ - Return type
bool
Reads an picture into memory and returns
true
if the picture was successfully read; otherwise returnsfalse
.Before reading an picture 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.
Setting the picture file format string is optional.
Note that this function does not set the
format
used to read the picture. If you need that information, use thepictureFormat()
static functions.Example:
iio = QPictureIO() pixmap = QPixmap() iio.setFileName("vegeburger.pic") if iio.read(): # OK picture = iio.picture() painter = QPainter(pixmap) painter.drawPicture(0, 0, picture)
See also
-
PySide2.QtGui.QPictureIO.
setDescription
(arg__1)¶ - Parameters
arg__1 – unicode
Sets the picture description string for picture handlers that support picture descriptions to
description
.Currently, no picture format supported by Qt uses the description string.
See also
-
PySide2.QtGui.QPictureIO.
setFileName
(arg__1)¶ - Parameters
arg__1 – unicode
Sets the name of the file to read or write an picture from to
fileName
.See also
-
PySide2.QtGui.QPictureIO.
setFormat
(arg__1)¶ - Parameters
arg__1 – str
Sets the picture format to
format
for the picture to be read or written.It is necessary to specify a format before writing an picture, but it is not necessary to specify a format before reading an picture.
If no format has been set, Qt guesses the picture format before reading it. If a format is set the picture will only be read if it has that format.
-
PySide2.QtGui.QPictureIO.
setGamma
(arg__1)¶ - Parameters
arg__1 –
float
Sets the gamma value at which the picture will be viewed to
gamma
. If the picture format stores a gamma value for which the picture is intended to be used, then this setting will be used to modify the picture. Setting to 0.0 will disable gamma correction (i.e. any specification in the file will be ignored).The default value is 0.0.
See also
-
PySide2.QtGui.QPictureIO.
setIODevice
(arg__1)¶ - Parameters
arg__1 –
QIODevice
Sets the IO device to be used for reading or writing an picture.
Setting the IO device allows pictures to be read/written to any block-oriented
QIODevice
.If
ioDevice
is not null, this IO device will override file name settings.See also
-
PySide2.QtGui.QPictureIO.
setParameters
(arg__1)¶ - Parameters
arg__1 – str
Sets the picture’s parameter string to
parameters
. This is for picture handlers that require special parameters.Although the current picture formats supported by Qt ignore the parameters string, it may be used in future extensions or by contributions (for example, JPEG).
See also
-
PySide2.QtGui.QPictureIO.
setPicture
(arg__1)¶ - Parameters
arg__1 –
QPicture
Sets the picture to
picture
.See also
-
PySide2.QtGui.QPictureIO.
setQuality
(arg__1)¶ - Parameters
arg__1 –
int
Sets the quality of the written picture to
q
, related to the compression ratio.q
must be in the range -1..100. Specify 0 to obtain small compressed files, 100 for large uncompressed files. (-1 signifies the default compression.)
-
PySide2.QtGui.QPictureIO.
setStatus
(arg__1)¶ - Parameters
arg__1 –
int
Sets the picture IO status to
status
. A non-zero value indicates an error, whereas 0 means that the IO operation was successful.See also
-
PySide2.QtGui.QPictureIO.
status
()¶ - Return type
int
Returns the picture’s IO status. A non-zero value indicates an error, whereas 0 means that the IO operation was successful.
See also
-
PySide2.QtGui.QPictureIO.
write
()¶ - Return type
bool
Writes an picture to an IO device and returns
true
if the picture was successfully written; otherwise returnsfalse
.Before writing an picture 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.
The picture will be written using the specified picture format.
Example:
iio = QPictureIO() picture = QPicture() painter = QPainter(picture) painter.drawPixmap(0, 0, pixmap) iio.setPicture(picture) iio.setFileName("vegeburger.pic") iio.setFormat("PIC") if iio.write(): return True # returned true if written successfully
See also
© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.