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 max size

QImage max size

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 5 Posters 5.5k 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.
  • B Offline
    B Offline
    bronstein87
    wrote on 12 Jan 2017, 14:55 last edited by
    #1

    When I am forming QImage with format QImage Format :: FormatMono with size more than 32767x32767, it is formed, however, when i am trying to render something on this image beyond the boundaries of the above, all trimmed. Why?
    For example, this image has size 82500x30000, but it was trimmed on the border 32767.
    alt text

    R M 2 Replies Last reply 12 Jan 2017, 15:28
    0
    • B bronstein87
      12 Jan 2017, 14:55

      When I am forming QImage with format QImage Format :: FormatMono with size more than 32767x32767, it is formed, however, when i am trying to render something on this image beyond the boundaries of the above, all trimmed. Why?
      For example, this image has size 82500x30000, but it was trimmed on the border 32767.
      alt text

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 12 Jan 2017, 15:28 last edited by raven-worx 1 Dec 2017, 15:29
      #2

      @bronstein87 said in QImage max size:

      32767

      please show your painting code. You probably have some conversion errors (if you are on a common Desktop environment)

      What Qt version are you using?
      On what system are you on?

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      B 1 Reply Last reply 12 Jan 2017, 16:04
      1
      • B bronstein87
        12 Jan 2017, 14:55

        When I am forming QImage with format QImage Format :: FormatMono with size more than 32767x32767, it is formed, however, when i am trying to render something on this image beyond the boundaries of the above, all trimmed. Why?
        For example, this image has size 82500x30000, but it was trimmed on the border 32767.
        alt text

        M Offline
        M Offline
        mtrch
        wrote on 12 Jan 2017, 15:49 last edited by
        #3

        QPainter documentation says:

        Limitations
        If you are using coordinates with Qt's raster-based paint engine, it is important to note that, while coordinates greater than +/- 2^15 can be used, any painting performed with coordinates outside this range is not guaranteed to be shown; the drawing may be clipped. This is due to the use of short int in the implementation.

        R B 2 Replies Last reply 12 Jan 2017, 15:53
        4
        • M mtrch
          12 Jan 2017, 15:49

          QPainter documentation says:

          Limitations
          If you are using coordinates with Qt's raster-based paint engine, it is important to note that, while coordinates greater than +/- 2^15 can be used, any painting performed with coordinates outside this range is not guaranteed to be shown; the drawing may be clipped. This is due to the use of short int in the implementation.

          R Offline
          R Offline
          raven-worx
          Moderators
          wrote on 12 Jan 2017, 15:53 last edited by raven-worx 1 Dec 2017, 15:54
          #4

          @mtrch
          good catch.

          I am wondering if a workaround using QPainter::translate() is working, or if it also runs into the same limitation in the end.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • R raven-worx
            12 Jan 2017, 15:28

            @bronstein87 said in QImage max size:

            32767

            please show your painting code. You probably have some conversion errors (if you are on a common Desktop environment)

            What Qt version are you using?
            On what system are you on?

            B Offline
            B Offline
            bronstein87
            wrote on 12 Jan 2017, 16:04 last edited by
            #5

            @raven-worx
            QT version- 5.7, system - win7 64.
            Code example:

            QImage* example_img= new QImage(40000,40000,QImage::Format_Mono);
            QPainter painter_for_text(example_img);
            QPen pen_for_text;
            pen_for_text.setColor(QColor(255,255,255,255));
            QFont font = painter_for_text.font();
            font.setPixelSize(8000);
            
            painter_for_text.setFont(font);
            painter_for_text.setPen(pen_for_text);
            
            painter_for_text.drawText(20000,20000,QString("HELLO,HELLO,HELLO"));
            QImageWriter writer;
            writer.setFormat("tiff");
            QString filename_save = QFileDialog::getSaveFileName(this,
                                                                     tr("Save tiff"), ".",
                                                                     tr("tiff files (*.tiff)"));
            writer.setFileName(filename_save);
            writer.write(*example_img);
            
            1 Reply Last reply
            0
            • M mtrch
              12 Jan 2017, 15:49

              QPainter documentation says:

              Limitations
              If you are using coordinates with Qt's raster-based paint engine, it is important to note that, while coordinates greater than +/- 2^15 can be used, any painting performed with coordinates outside this range is not guaranteed to be shown; the drawing may be clipped. This is due to the use of short int in the implementation.

              B Offline
              B Offline
              bronstein87
              wrote on 12 Jan 2017, 17:20 last edited by
              #6

              @mtrch It turns out, nothing can be done?

              1 Reply Last reply
              0
              • B Offline
                B Offline
                bronstein87
                wrote on 12 Jan 2017, 17:29 last edited by
                #7

                I looked into qpainter.cpp and there is no any short int in implementation
                [https://searchcode.com/codesearch/view/33959834/](link url)

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 14 Jan 2017, 13:32 last edited by
                  #8

                  it might be OS limitation.
                  At least windows used to have it.
                  Didnt check lately.

                  1 Reply Last reply
                  0
                  • Chris KawaC Offline
                    Chris KawaC Offline
                    Chris Kawa
                    Lifetime Qt Champion
                    wrote on 14 Jan 2017, 14:03 last edited by Chris Kawa
                    #9

                    @bronstein87 said in QImage max size:

                    I looked into qpainter.cpp and there is no any short int in implementation
                    [https://searchcode.com/codesearch/view/33959834/](link url)

                    Read carefully. It's not the QPainter that is limited by usage of shorts, it's the raster paint engine. For example look in qpaintengine_raster.cpp. It uses short for any type of clipping.

                    Btw. 82500x30000 is like 300Mb of data (in mono format). Can't you chop it into smaller pieces?

                    B 1 Reply Last reply 14 Jan 2017, 17:33
                    3
                    • Chris KawaC Chris Kawa
                      14 Jan 2017, 14:03

                      @bronstein87 said in QImage max size:

                      I looked into qpainter.cpp and there is no any short int in implementation
                      [https://searchcode.com/codesearch/view/33959834/](link url)

                      Read carefully. It's not the QPainter that is limited by usage of shorts, it's the raster paint engine. For example look in qpaintengine_raster.cpp. It uses short for any type of clipping.

                      Btw. 82500x30000 is like 300Mb of data (in mono format). Can't you chop it into smaller pieces?

                      B Offline
                      B Offline
                      bronstein87
                      wrote on 14 Jan 2017, 17:33 last edited by
                      #10

                      @Chris-Kawa the point of creating such a large image, is to not merge it manually after...

                      1 Reply Last reply
                      0

                      1/10

                      12 Jan 2017, 14:55

                      • Login

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