Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Save picture in bmp format

    General and Desktop
    5
    7
    1358
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      descom_g last edited by descom_g

      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.

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi and welcome to devnet,

        Please show the code you use to save your images.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • D
          descom_g last edited by

           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.

          jsulm 1 Reply Last reply Reply Quote 0
          • jsulm
            jsulm Lifetime Qt Champion @descom_g last edited by

            @descom_g Shouldn't it be

            imageSettings.setCodec("image/bmp");
            

            ?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote 0
            • D
              descom_g last edited by

              I have already tried it and that still save in jpg.

              mrjj 1 Reply Last reply Reply Quote 0
              • mrjj
                mrjj Lifetime Qt Champion @descom_g last edited by

                @descom_g
                hi
                Try to list the codec available to be sure

                foreach(const QString &codecName, imagecapture->supportedImageCodecs()) {
                qDebug() << ...

                1 Reply Last reply Reply Quote 3
                • N
                  newbieqt last edited by

                  I am trying to do the same on Windows and not able to set the image format. supportedImageCodecs() returns an empty list. Does anyone know a workaround to set image encoding on Windows?

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post