Save picture in bmp format
Unsolved
General and Desktop
-
Hello,
I want to save a picture from my camera in a bmp format.
I use a QImageEncoderSettings class to do it but I cannot save in bmp format, I read the docs about this class but I still dont success to use correctly the "setCodec" to have the bmp format.Thanks for your help.
-
Hi and welcome to devnet,
Please show the code you use to save your images.
-
auto filename = QFileDialog::getSaveFileName(this, tr("Save Image"), ".", tr("Image (*.bmp)")); if (filename.isEmpty()) return; mCameraImageCapture->setCaptureDestination(QCameraImageCapture::CaptureToFile); QImageEncoderSettings imageSettings; imageSettings.setCodec("bmp"); imageSettings.setResolution(1024, 1280); mCameraImageCapture->setEncodingSettings(imageSettings); mCamera->setCaptureMode(QCamera::CaptureStillImage); mCamera->start(); mCamera->searchAndLock(); mCameraImageCapture->capture(filename); mCamera->unlock();
The image still save on default(jpg) format with this code.
-
auto filename = QFileDialog::getSaveFileName(this, tr("Save Image"), ".", tr("Image (*.bmp)")); if (filename.isEmpty()) return; mCameraImageCapture->setCaptureDestination(QCameraImageCapture::CaptureToFile); QImageEncoderSettings imageSettings; imageSettings.setCodec("bmp"); imageSettings.setResolution(1024, 1280); mCameraImageCapture->setEncodingSettings(imageSettings); mCamera->setCaptureMode(QCamera::CaptureStillImage); mCamera->start(); mCamera->searchAndLock(); mCameraImageCapture->capture(filename); mCamera->unlock();
The image still save on default(jpg) format with this code.