Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Save picture in bmp format
Forum Updated to NodeBB v4.3 + New Features

Save picture in bmp format

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 5 Posters 1.8k Views 2 Watching
  • 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 Offline
    D Offline
    descom_g
    wrote on last edited by descom_g
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      0
      • D Offline
        D Offline
        descom_g
        wrote on last edited by
        #3
         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.

        jsulmJ 1 Reply Last reply
        0
        • D descom_g
           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.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @descom_g Shouldn't it be

          imageSettings.setCodec("image/bmp");
          

          ?

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

          1 Reply Last reply
          0
          • D Offline
            D Offline
            descom_g
            wrote on last edited by
            #5

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

            mrjjM 1 Reply Last reply
            0
            • D descom_g

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

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

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

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

              1 Reply Last reply
              3
              • N Offline
                N Offline
                newbieqt
                wrote on last edited by
                #7

                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
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved