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. QImage QRGB 64 bit pixel
Forum Update on Monday, May 27th 2025

QImage QRGB 64 bit pixel

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 933 Views
  • 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.
  • C Offline
    C Offline
    csing
    wrote on last edited by csing
    #1

    Hello,

    I am trying to convert my pngs from QImage::Format_RGB888 to QImage::Format_RGBA64. Although I can create the image as the RGBA64 format just fine, I am not sure how to manipulate the color channels and pixels? Right now I use the pixel() function which will return a qrgb type which truncates the qrgb64 type values. for example

    QRgb rgbPixel = loadImage.pixel(i,j);
    

    How can I convert this into a Qrgb64 type values and get each of the individual channels? Thank you!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What kind of manipulation do you have in mind ?

      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
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @csing said in QImage QRGB 64 bit pixel:

        How can I convert this into a Qrgb64 type values and get each of the individual channels? Thank you!

        Use QImage::scanLine() and cast to QRgba64

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        1
        • C Offline
          C Offline
          csing
          wrote on last edited by
          #4

          @SGaist I want to be able to extract the red blue and green values from each of the pixels of the image.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Then why change the format of the image in that case ?

            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
            • C Offline
              C Offline
              csing
              wrote on last edited by csing
              #6

              @Christian-Ehrlicher Hi, I am not sure if I am doing it correctly but it is still returning the range of the blue values are still all under 256 when I am debugging it. Here is what I wrote to test the method. Please let me know if you see something I am wrong. Thanks!

                    for(int i = 0; i < loadImage.height(); i++) {
                        pixel64 = (QRgba64 *)loadImage.scanLine(i);
                        blue = qBlue(*pixel64);
                    }
              

              @SGaist The end goal I am trying to reach is to be able to produce a higher-bit pngs rather than a 8-bit png and from my understanding is that the Format_RGB888 and using pixel() will crop off some of the bits.

              1 Reply Last reply
              0
              • Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #7

                What data type is your 'blue' variable of? Are you sure your image has really the format QImage::Format_RGBA64?

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                1 Reply Last reply
                1
                • C Offline
                  C Offline
                  csing
                  wrote on last edited by
                  #8

                  @Christian-Ehrlicher Thank you for pointing out the scanline method. I have figured it out. I should be using pixel64.blue() instead of qBlue() which will return a 8 bit value instead. Thank you for your help!

                  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