QImageCapture#
The QImageCapture
class is used for the recording of media content. More…
Synopsis#
Properties#
fileFormat
- Image formatmetaData
- Meta data that will get embedded into the imagequality
- Image encoding quality
Functions#
def
addMetaData
(metaData)def
captureSession
()def
error
()def
errorString
()def
fileFormat
()def
isAvailable
()def
isReadyForCapture
()def
metaData
()def
quality
()def
resolution
()def
setFileFormat
(format)def
setMetaData
(metaData)def
setQuality
(quality)def
setResolution
(arg__1)def
setResolution
(width, height)
Slots#
def
capture
()def
captureToFile
([location=””])
Signals#
def
errorChanged
()def
errorOccurred
(id, error, errorString)def
fileFormatChanged
()def
imageAvailable
(id, frame)def
imageCaptured
(id, preview)def
imageExposed
(id)def
imageMetadataAvailable
(id, metaData)def
imageSaved
(id, fileName)def
metaDataChanged
()def
qualityChanged
()def
readyForCaptureChanged
(ready)def
resolutionChanged
()
Static functions#
def
fileFormatDescription
(c)def
fileFormatName
(c)def
supportedFormats
()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description#
Warning
This section contains snippets that were automatically translated from C++ to Python and may contain errors.
The QImageCapture
class is a high level images recording class. It’s not intended to be used alone but for accessing the media recording functions of other media objects, like QCamera
.
captureSession = QMediaCaptureSession() camera = QCamera() captureSession.setCamera(camera) viewfinder = QVideoWidget() viewfinder.show() captureSession.setVideoOutput(viewfinder) imageCapture = QImageCapture(camera) captureSession.setImageCapture(imageCapture) camera.start() #on shutter button pressed imageCapture.capture()See also
- class PySide6.QtMultimedia.QImageCapture([parent=None])#
- Parameters:
parent –
PySide6.QtCore.QObject
Constructs a image capture object, from a parent
, that can capture individual still images produced by a camera.
You must connect both an image capture object and a QCamera
to a capture session to capture images.
Note
Properties can be used directly when from __feature__ import true_property
is used or via accessor functions otherwise.
- property PᅟySide6.QtMultimedia.QImageCapture.error: Error#
Returns the current error state.
See also
- Access functions:
error
()Signal
errorChanged
()
- property PᅟySide6.QtMultimedia.QImageCapture.errorString: str#
Returns a string describing the current error state.
See also
- Access functions:
errorString
()Signal
errorChanged
()
- property PᅟySide6.QtMultimedia.QImageCapture.fileFormat: FileFormat#
This property holds The image format..
- Access functions:
fileFormat
()Signal
fileFormatChanged
()
- property PᅟySide6.QtMultimedia.QImageCapture.metaData: PySide6.QtMultimedia.QMediaMetaData#
This property holds The meta data that will get embedded into the image..
Note
Additional fields such as a time stamp or location may get added by the camera back end.
- Access functions:
metaData
()setMetaData
(metaData)Signal
metaDataChanged
()
- property PᅟySide6.QtMultimedia.QImageCapture.quality: Quality#
This property holds The image encoding quality..
- Access functions:
quality
()Signal
qualityChanged
()
- property PᅟySide6.QtMultimedia.QImageCapture.readyForCapture: bool#
Holds true
if the camera is ready to capture an image immediately. Calling capture()
while readyForCapture
is false
is not permitted and results in an error.
- Access functions:
Signal
readyForCaptureChanged
(ready)
- PySide6.QtMultimedia.QImageCapture.Error#
Constant
Description
QImageCapture.NoError
No Errors.
QImageCapture.NotReadyError
The service is not ready for capture yet.
QImageCapture.ResourceError
Device is not ready or not available.
QImageCapture.OutOfSpaceError
No space left on device.
QImageCapture.NotSupportedFeatureError
Device does not support stillimages capture.
QImageCapture.FormatError
Current format is not supported.
- PySide6.QtMultimedia.QImageCapture.Quality#
Enumerates quality encoding levels.
Constant
Description
QImageCapture.VeryLowQuality
QImageCapture.LowQuality
QImageCapture.NormalQuality
QImageCapture.HighQuality
QImageCapture.VeryHighQuality
- PySide6.QtMultimedia.QImageCapture.FileFormat#
Choose one of the following image formats:
Constant
Description
QImageCapture.UnspecifiedFormat
No format specified
QImageCapture.JPEG
.jpg
or.jpeg
formatQImageCapture.PNG
.png
formatQImageCapture.WebP
.webp
formatQImageCapture.Tiff
.tiff
format
- PySide6.QtMultimedia.QImageCapture.addMetaData(metaData)#
- Parameters:
metaData –
PySide6.QtMultimedia.QMediaMetaData
Adds additional metaData
to any existing meta data, that is embedded into the captured image.
- PySide6.QtMultimedia.QImageCapture.capture()#
- Return type:
int
Capture the image and make it available as a QImage
. This operation is asynchronous in majority of cases, followed by signals imageExposed()
, imageCaptured()
or error()
.
QImageCapture::capture returns the capture Id parameter, used with imageExposed()
, imageCaptured()
and imageSaved()
signals.
See also
- PySide6.QtMultimedia.QImageCapture.captureSession()#
- Return type:
Returns the capture session this camera is connected to, or a nullptr if the camera is not connected to a capture session.
Use setImageCapture()
to connect the image capture to a session.
- PySide6.QtMultimedia.QImageCapture.captureToFile([location=""])#
- Parameters:
location – str
- Return type:
int
Capture the image and save it to file
. This operation is asynchronous in majority of cases, followed by signals imageExposed()
, imageCaptured()
, imageSaved()
or error()
.
If an empty file
is passed, the camera back end chooses the default location and naming scheme for photos on the system, if only file name without full path is specified, the image will be saved to the default directory, with a full path reported with imageCaptured()
and imageSaved()
signals.
QCamera
saves all the capture parameters like exposure settings or image processing parameters, so changes to camera parameters after capture()
is called do not affect previous capture requests.
capture
returns the capture Id parameter, used with imageExposed()
, imageCaptured()
and imageSaved()
signals.
See also
Getter of property error
.
- PySide6.QtMultimedia.QImageCapture.errorChanged()#
Notification signal of property error
.
- PySide6.QtMultimedia.QImageCapture.errorOccurred(id, error, errorString)#
- Parameters:
id – int
error –
Error
errorString – str
Signals that the capture request id
has failed with an error
and errorString
description.
- PySide6.QtMultimedia.QImageCapture.errorString()#
- Return type:
str
Getter of property errorString
.
- PySide6.QtMultimedia.QImageCapture.fileFormat()#
- Return type:
See also
Getter of property fileFormat
.
- PySide6.QtMultimedia.QImageCapture.fileFormatChanged()#
Notification signal of property fileFormat
.
- static PySide6.QtMultimedia.QImageCapture.fileFormatDescription(c)#
- Parameters:
c –
FileFormat
- Return type:
str
Returns the description of the given file format, f
.
- static PySide6.QtMultimedia.QImageCapture.fileFormatName(c)#
- Parameters:
c –
FileFormat
- Return type:
str
Returns the name of the given format, f
.
- PySide6.QtMultimedia.QImageCapture.imageAvailable(id, frame)#
- Parameters:
id – int
frame –
PySide6.QtMultimedia.QVideoFrame
Signal emitted when the frame
with request id
is available.
- PySide6.QtMultimedia.QImageCapture.imageCaptured(id, preview)#
- Parameters:
id – int
preview –
PySide6.QtGui.QImage
Signal emitted when the frame with request id
was captured, but not processed and saved yet. Frame preview
can be displayed to user.
- PySide6.QtMultimedia.QImageCapture.imageExposed(id)#
- Parameters:
id – int
Signal emitted when the frame with request id
was exposed.
- PySide6.QtMultimedia.QImageCapture.imageMetadataAvailable(id, metaData)#
- Parameters:
id – int
metaData –
PySide6.QtMultimedia.QMediaMetaData
Signals that an image identified by id
has metaData
.
- PySide6.QtMultimedia.QImageCapture.imageSaved(id, fileName)#
- Parameters:
id – int
fileName – str
Signal emitted when QImageCapture::CaptureToFile is set and the frame with request id
was saved to fileName
.
- PySide6.QtMultimedia.QImageCapture.isAvailable()#
- Return type:
bool
Returns true if the images capture service ready to use.
- PySide6.QtMultimedia.QImageCapture.isReadyForCapture()#
- Return type:
bool
Getter of property readyForCapture
.
- PySide6.QtMultimedia.QImageCapture.metaData()#
- Return type:
See also
Getter of property metaData
.
- PySide6.QtMultimedia.QImageCapture.metaDataChanged()#
Notification signal of property metaData
.
- PySide6.QtMultimedia.QImageCapture.quality()#
- Return type:
See also
Getter of property quality
.
- PySide6.QtMultimedia.QImageCapture.qualityChanged()#
Notification signal of property quality
.
- PySide6.QtMultimedia.QImageCapture.readyForCaptureChanged(ready)#
- Parameters:
ready – bool
Signals that a camera’s ready
for capture state has changed.
Notification signal of property readyForCapture
.
- PySide6.QtMultimedia.QImageCapture.resolution()#
- Return type:
Returns the resolution of the encoded image.
See also
- PySide6.QtMultimedia.QImageCapture.resolutionChanged()#
Signals when the image resolution changes.
- PySide6.QtMultimedia.QImageCapture.setFileFormat(format)#
- Parameters:
format –
FileFormat
Sets the image format
.
See also
- PySide6.QtMultimedia.QImageCapture.setMetaData(metaData)#
- Parameters:
metaData –
PySide6.QtMultimedia.QMediaMetaData
Replaces any existing meta data, to be embedded into the captured image, with a set of metaData
.
See also
Setter of property metaData
.
Sets the image encoding quality
.
See also
- PySide6.QtMultimedia.QImageCapture.setResolution(arg__1)#
- Parameters:
arg__1 –
PySide6.QtCore.QSize
Sets the resolution
of the encoded image.
An empty QSize
indicates the encoder should make an optimal choice based on what is available from the image source and the limitations of the codec.
See also
- PySide6.QtMultimedia.QImageCapture.setResolution(width, height)
- Parameters:
width – int
height – int
Sets the width
and height
of the resolution of the encoded image.
This is an overloaded function.
- static PySide6.QtMultimedia.QImageCapture.supportedFormats()#
- Return type:
Returns a list of supported file formats.
See also
FileFormat