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
Forum Updated to NodeBB v4.3 + New Features

QImage max size

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 5 Posters 5.5k Views 5 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.
  • B Offline
    B Offline
    bronstein87
    wrote on 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

    raven-worxR M 2 Replies Last reply
    0
    • B bronstein87

      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

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #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
      1
      • B bronstein87

        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 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.

        raven-worxR B 2 Replies Last reply
        4
        • M mtrch

          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.

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by raven-worx
          #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
          • raven-worxR raven-worx

            @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 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

              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 last edited by
              #6

              @mtrch It turns out, nothing can be done?

              1 Reply Last reply
              0
              • B Offline
                B Offline
                bronstein87
                wrote on 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
                • mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 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 Online
                    Chris KawaC Online
                    Chris Kawa
                    Lifetime Qt Champion
                    wrote on 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
                    3
                    • Chris KawaC Chris Kawa

                      @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 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

                      • Login

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