PySide6.QtMultimedia.QImageCapture¶
- class QImageCapture¶
- The - QImageCaptureclass is used for the recording of media content. More…- Synopsis¶- Properties¶
- fileFormatᅟ- Image format
- metaDataᅟ- Meta data that will get embedded into the image
- qualityᅟ- Image encoding quality
 - Methods¶- def - __init__()
- def - addMetaData()
- def - captureSession()
- def - error()
- def - errorString()
- def - fileFormat()
- def - isAvailable()
- def - metaData()
- def - quality()
- def - resolution()
- def - setFileFormat()
- def - setMetaData()
- def - setQuality()
- def - setResolution()
 - Slots¶- def - capture()
- def - captureToFile()
 - Signals¶- def - errorChanged()
- def - errorOccurred()
- def - imageAvailable()
- def - imageCaptured()
- def - imageExposed()
- def - imageSaved()
- def - qualityChanged()
 - Static functions¶- 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 - QImageCaptureclass 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 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. 
 - class Quality¶
- Enumerates quality encoding levels. - Constant - Description - QImageCapture.VeryLowQuality - QImageCapture.LowQuality - QImageCapture.NormalQuality - QImageCapture.HighQuality - QImageCapture.VeryHighQuality 
 - class FileFormat¶
- Choose one of the following image formats: - Constant - Description - QImageCapture.UnspecifiedFormat - No format specified - QImageCapture.JPEG - .jpgor- .jpegformat- QImageCapture.PNG - .pngformat- QImageCapture.WebP - .webpformat- QImageCapture.Tiff - .tiffformat
 - Note - Properties can be used directly when - from __feature__ import true_propertyis used or via accessor functions otherwise.- property errorᅟ: QImageCapture.Error¶
 - Returns the current error state. - See also - Access functions:
- Signal - errorChanged()
 
 - property errorStringᅟ: str¶
 - Returns a string describing the current error state. - See also - Access functions:
- Signal - errorChanged()
 
 - property fileFormatᅟ: QImageCapture.FileFormat¶
 - This property holds The image format.. - Access functions:
- Signal - fileFormatChanged()
 
 - property metaDataᅟ: 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:
 - property qualityᅟ: QImageCapture.Quality¶
 - This property holds The image encoding quality.. - Access functions:
- Signal - qualityChanged()
 
 - property readyForCaptureᅟ: bool¶
 - Holds - trueif the camera is ready to capture an image immediately. Calling- capture()while- readyForCaptureis- falseis not permitted and results in an error.- Access functions:
 - 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 - QCamerato a capture session to capture images.- addMetaData(metaData)¶
- Parameters:
- metaData – - QMediaMetaData
 
 - Adds additional - metaDatato any existing meta data, that is embedded into the captured image.- 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 - 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.- 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 - fileis 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.- QCamerasaves 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.- capturereturns the capture Id parameter, used with- imageExposed(),- imageCaptured()and- imageSaved()signals.- See also - Getter of property - errorᅟ.- errorChanged()¶
 - Notification signal of property - errorᅟ.- Signals that the capture request - idhas failed with an- errorand- errorStringdescription.- errorString()¶
- Return type:
- str 
 
 - Getter of property - errorStringᅟ.- fileFormat()¶
- Return type:
 - See also 
 - Getter of property - fileFormatᅟ.- fileFormatChanged()¶
 - Notification signal of property - fileFormatᅟ.- static fileFormatDescription(c)¶
- Parameters:
- c – - FileFormat
- Return type:
- str 
 
 - Returns the description of the given file format, - f.- static fileFormatName(c)¶
- Parameters:
- c – - FileFormat
- Return type:
- str 
 
 - Returns the name of the given format, - f.- imageAvailable(id, frame)¶
- Parameters:
- id – int 
- frame – - QVideoFrame
 
 
 - Signal emitted when the - framewith request- idis available.- Signal emitted when the frame with request - idwas captured, but not processed and saved yet. Frame- previewcan be displayed to user.- imageExposed(id)¶
- Parameters:
- id – int 
 
 - Signal emitted when the frame with request - idwas exposed.- imageMetadataAvailable(id, metaData)¶
- Parameters:
- id – int 
- metaData – - QMediaMetaData
 
 
 - Signals that an image identified by - idhas- metaData.- imageSaved(id, fileName)¶
- Parameters:
- id – int 
- fileName – str 
 
 
 - Signal emitted when QImageCapture::CaptureToFile is set and the frame with request - idwas saved to- fileName.- isAvailable()¶
- Return type:
- bool 
 
 - Returns true if the images capture service ready to use. - isReadyForCapture()¶
- Return type:
- bool 
 
 - Getter of property - readyForCaptureᅟ.- metaData()¶
- Return type:
 - See also 
 - Getter of property - metaDataᅟ.- metaDataChanged()¶
 - Notification signal of property - metaDataᅟ.- quality()¶
- Return type:
 - See also 
 - Getter of property - qualityᅟ.- qualityChanged()¶
 - Notification signal of property - qualityᅟ.- readyForCaptureChanged(ready)¶
- Parameters:
- ready – bool 
 
 - Signals that a camera’s - readyfor capture state has changed.- Notification signal of property - readyForCaptureᅟ.- Returns the resolution of the encoded image. - See also - resolutionChanged()¶
 - Signals when the image resolution changes. - setFileFormat(format)¶
- Parameters:
- format – - FileFormat
 
 - Sets the image - format.- See also - setMetaData(metaData)¶
- Parameters:
- metaData – - 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 - Sets the - resolutionof 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 - setResolution(width, height)
- Parameters:
- width – int 
- height – int 
 
 
 - Sets the - widthand- heightof the resolution of the encoded image.- This is an overloaded function. - static supportedFormats()¶
- Return type:
- .list of QImageCapture.FileFormat 
 
 - Returns a list of supported file formats. - See also