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. Is there a way to save image in a different bit depth then the platform display depth ?
Forum Updated to NodeBB v4.3 + New Features

Is there a way to save image in a different bit depth then the platform display depth ?

Scheduled Pinned Locked Moved General and Desktop
10 Posts 4 Posters 5.4k Views 1 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.
  • A Offline
    A Offline
    aabc
    wrote on 30 Jul 2012, 14:36 last edited by
    #1

    Is there a way to save image in a different bit depth then the platform display depth ?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DerManu
      wrote on 30 Jul 2012, 15:08 last edited by
      #2

      See QImage::Format
      http://qt-project.org/doc/qt-4.8/qimage.html#Format-enum

      1 Reply Last reply
      0
      • A Offline
        A Offline
        aabc
        wrote on 30 Jul 2012, 15:32 last edited by
        #3

        The problem is that it only loads the image in this format but when I save it then it saved with the display format and not in the format I specified

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DerManu
          wrote on 30 Jul 2012, 22:11 last edited by
          #4

          Works perfectly for me.
          @QImage("./test.jpg").convertToFormat(QImage::Format_Mono).save("./test2.bmp");@

          1 Reply Last reply
          0
          • A Offline
            A Offline
            aabc
            wrote on 31 Jul 2012, 06:36 last edited by
            #5

            I used the same way:
            @
            QImage("./myPic.png").convertToFormat(QImage::Format_ARGB8565_Premultiplied).save("./myPic.png");
            @
            But when i checked "./myPic.png" depth and format after the conversion it was the same as before (32 bit).
            Did you try that?

            1 Reply Last reply
            0
            • D Offline
              D Offline
              DerManu
              wrote on 31 Jul 2012, 06:43 last edited by
              #6

              Wikipedia says:

              bq. PNG supports palette-based images (with palettes of 24-bit RGB or 32-bit RGBA colors), grayscale images (with or without alpha channel), and full-color non-palette-based RGB[A] images (with or without alpha channel)

              So I suppose this peculiar format just isn't supported by the PNG standard.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                aabc
                wrote on 31 Jul 2012, 10:52 last edited by
                #7

                Thanks.

                Do you know what happens "under the hood" when you use a .png on a 16 bit display device (is there a conversion) ?

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  DerManu
                  wrote on 31 Jul 2012, 11:25 last edited by
                  #8

                  There has to be a conversion, else, you'd see very funny colors and possibly sheared images. I don't know whether it happens in Qt, in the window system or the display driver. I'm guessing the window system. But you should look into the respective Qt code to see what's really going on.

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    Chesterton WORD
                    wrote on 27 Feb 2013, 09:29 last edited by
                    #9

                    As much as i know, you can save your image to any aviliable format, then you can apply some "image processing component ":http://www.rasteredge.com/dotnet-imaging/image-convert/to get your target.

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      classpass
                      wrote on 14 Feb 2014, 07:14 last edited by
                      #10

                      if it only save image in one format. how about we convert image before saving with powerufl tool. in this way you can get a different bit depth image when you finish saving. window system is quite fine to me.

                      see: "image converter":http://www.rasteredge.com/how-to/winforms-net-imaging/image-converting/ /"image saving control":http://www.rasteredge.com/how-to/winforms-net-imaging/imaging-saving-printing/

                      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