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. Large offscreen bitmap, QImage *toImage* failing
Forum Updated to NodeBB v4.3 + New Features

Large offscreen bitmap, QImage *toImage* failing

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 4 Posters 700 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.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by
    #1

    Qt 5.9.2, MSVC 2015, Windows 10.

    The C++ application I'm writing creates offscreen images based on the source data file, in a new case with a very large file the offscreen image is huge, using Qt Creator I can see the offscreen painter is set-up and I paint to it, the issue is when I want to take part of the offscreen painter to display:

    QImage imgStrip(mpOffscreen->toImage());
    if ( imgStrip.isNull() == true )
    

    imgStrip is returning null, the height of the offscreen area is 800168.

    Is there an alternative to toImage so instead of taking the whole offscreen painter as an image I can take a specific section of it?

    Kind Regards,
    Sy

    eyllanescE 1 Reply Last reply
    0
    • SPlattenS SPlatten

      Qt 5.9.2, MSVC 2015, Windows 10.

      The C++ application I'm writing creates offscreen images based on the source data file, in a new case with a very large file the offscreen image is huge, using Qt Creator I can see the offscreen painter is set-up and I paint to it, the issue is when I want to take part of the offscreen painter to display:

      QImage imgStrip(mpOffscreen->toImage());
      if ( imgStrip.isNull() == true )
      

      imgStrip is returning null, the height of the offscreen area is 800168.

      Is there an alternative to toImage so instead of taking the whole offscreen painter as an image I can take a specific section of it?

      eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on last edited by
      #2

      @SPlatten maybe https://stackoverflow.com/questions/7080052/qimage-qpixmap-size-limitations

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

      SPlattenS 1 Reply Last reply
      0
      • eyllanescE eyllanesc

        @SPlatten maybe https://stackoverflow.com/questions/7080052/qimage-qpixmap-size-limitations

        SPlattenS Offline
        SPlattenS Offline
        SPlatten
        wrote on last edited by
        #3

        @eyllanesc said in Large offscreen bitmap, QImage *toImage* failing:

        https://stackoverflow.com/questions/7080052/qimage-qpixmap-size-limitations

        Thank you, I will have to rethink how I'm doing this, in the original design this sort of size was never factored in, It's just be sprung on me.

        Kind Regards,
        Sy

        SPlattenS 1 Reply Last reply
        0
        • SPlattenS SPlatten

          @eyllanesc said in Large offscreen bitmap, QImage *toImage* failing:

          https://stackoverflow.com/questions/7080052/qimage-qpixmap-size-limitations

          Thank you, I will have to rethink how I'm doing this, in the original design this sort of size was never factored in, It's just be sprung on me.

          SPlattenS Offline
          SPlattenS Offline
          SPlatten
          wrote on last edited by
          #4

          Does anyone have a solution or suggestion?

          The problem and requirement is, given a dataset, these are called B-Scans. A B-Scan consists of 6 sections. I have definitions in a database called BScanX and BScanY which defined how many pixels a B-Scan occupies. X = 32, Y = 8.

          I determine the number of B-Scans from the file, the current worse case is 100021. The margin around the data area is 4 pixels, there is also a border all around of 4 pixels, which means an area of:

          8 + 8 + (6 * 32) = 208 pixels wide
          8 + 8 + (10021 * 8) = 80184 pixels high

          Even if I reduce the BScanY to 1 it will results in: 10037 pixels high.

          For other data sets which are very much smaller I obviously have areas that are smaller than 32767 and therefore can create a QImage from the painter context without any problem. I have spinners to set the minimum and maximum values to allow the user to zoom into a dataset, once the image is captured it is then scaled using the spinner values and then resized to fit a visible area.

          There is also a slider that functions like a scrollbar that allows the user to move the visible area through the offscreen image. This all works really well, or it did because it doesn't work at all with larger datasets.

          Kind Regards,
          Sy

          jsulmJ 1 Reply Last reply
          0
          • SPlattenS SPlatten

            Does anyone have a solution or suggestion?

            The problem and requirement is, given a dataset, these are called B-Scans. A B-Scan consists of 6 sections. I have definitions in a database called BScanX and BScanY which defined how many pixels a B-Scan occupies. X = 32, Y = 8.

            I determine the number of B-Scans from the file, the current worse case is 100021. The margin around the data area is 4 pixels, there is also a border all around of 4 pixels, which means an area of:

            8 + 8 + (6 * 32) = 208 pixels wide
            8 + 8 + (10021 * 8) = 80184 pixels high

            Even if I reduce the BScanY to 1 it will results in: 10037 pixels high.

            For other data sets which are very much smaller I obviously have areas that are smaller than 32767 and therefore can create a QImage from the painter context without any problem. I have spinners to set the minimum and maximum values to allow the user to zoom into a dataset, once the image is captured it is then scaled using the spinner values and then resized to fit a visible area.

            There is also a slider that functions like a scrollbar that allows the user to move the visible area through the offscreen image. This all works really well, or it did because it doesn't work at all with larger datasets.

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

            @SPlatten Since you can't show such big images at once you could crop the part you want to show and only create QImage from that crop.

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

            SPlattenS 1 Reply Last reply
            0
            • jsulmJ jsulm

              @SPlatten Since you can't show such big images at once you could crop the part you want to show and only create QImage from that crop.

              SPlattenS Offline
              SPlattenS Offline
              SPlatten
              wrote on last edited by
              #6

              @jsulm , thank you for the suggestion, thats part of the problem, the user needs to be able to review the entire image using spinners and sliders to zoom in or move around it.

              Kind Regards,
              Sy

              jsulmJ 1 Reply Last reply
              0
              • SPlattenS SPlatten

                @jsulm , thank you for the suggestion, thats part of the problem, the user needs to be able to review the entire image using spinners and sliders to zoom in or move around it.

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

                @SPlatten For showing images you should use https://doc.qt.io/qt-5/qpixmap.html
                Did you try that?
                And even with croping you can still implement scrolling, but it will of course require some work.

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

                SPlattenS 1 Reply Last reply
                0
                • jsulmJ jsulm

                  @SPlatten For showing images you should use https://doc.qt.io/qt-5/qpixmap.html
                  Did you try that?
                  And even with croping you can still implement scrolling, but it will of course require some work.

                  SPlattenS Offline
                  SPlattenS Offline
                  SPlatten
                  wrote on last edited by SPlatten
                  #8

                  @jsulm said in Large offscreen bitmap, QImage toImage failing:

                  https://doc.qt.io/qt-5/qpixmap.html

                  Yes thats exactly what I'm doing, I'm using toImage, however the QImage is limited to 32767x32767, thats the problem.

                  Kind Regards,
                  Sy

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

                    Hi,

                    What about stitching several QImages together ?

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

                    SPlattenS 1 Reply Last reply
                    1
                    • SGaistS SGaist

                      Hi,

                      What about stitching several QImages together ?

                      SPlattenS Offline
                      SPlattenS Offline
                      SPlatten
                      wrote on last edited by
                      #10

                      @SGaist , that is an option I’m considering, thank you

                      Kind Regards,
                      Sy

                      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