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. QImageReader::SetClipRect limitation on size(Large Image)
Forum Updated to NodeBB v4.3 + New Features

QImageReader::SetClipRect limitation on size(Large Image)

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 4.2k 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.
  • N Offline
    N Offline
    naughtykid
    wrote on last edited by
    #1

    The limitation on rect varies on systems, which I don't know why.
    I want to display a very large image 20000 x 30000 of image on graphicView.
    anyone encounter the limitation on this?

    @
    SetClipRect
    {
    System:
    Dell Vostro 1510
    Intel Core 2 Duo T8100 2.09 GHz
    3 GB of RAM
    Window XP 32 bit service pack 3
    QImageReader::setClipRect() support up to 13824 x 13824(vice versa) only

    System:
    AMD QuadCore phenom 3 GHz
    8 GB of RAM
    Window XP 64 bit
    QImageReader::setClipRect() support up to 14234 x 14235(vice versa) only

    System:
    Dell Vostro 1400
    Intel Core 2 Duo T7250 2.0 GHz
    2 GB of RAM
    Window XP 32 bit service pack 3
    QImageReader::setClipRect() support up to 15000 x 15894(vice versa) only

    System:
    Dell Vostro 3700
    Intel Core i5 2.27 GHz
    4 GB of Ram
    Window 7 64 bit
    QImageReader::setClipRect() support up to 18880 x 18881(vice versa) only
    }
    @

    EDIT: please use code highlighting by @-tags. thanks. Gerolf

    1 Reply Last reply
    0
    • ? This user is from outside of this forum
      ? This user is from outside of this forum
      Guest
      wrote on last edited by
      #2

      there are known issues of loading such large images .. you might want to break it to chunks and load and stitch them while displaying

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dangelog
        wrote on last edited by
        #3

        [quote author="naughtykid" date="1299743480"]The limitation on rect varies on systems, which I don't know why.
        I want to display a very large image 20000 x 30000 of image on graphicView.
        anyone encounter the limitation on this?[/quote]

        Are you aware that a 20k x 30k / 32bpp image requires 234E8 byte = 2,4 GByte of contiguous memory for being loaded? Yes, QImage isn't that smart. Split the image in chunks and load them on demand or so.

        Software Engineer
        KDAB (UK) Ltd., a KDAB Group company

        1 Reply Last reply
        0
        • N Offline
          N Offline
          naughtykid
          wrote on last edited by
          #4

          Thank you for the reply.

          Here's what I did:

          @
          {
          QImageReader reader1(file);
          reader1.setClipRect(QRect(halfWidth, 0, halfWidth, halfHeight));
          QPixmap img01 = QPixmap::fromImage(reader1.read());
          QGraphicsItem* itemHolder = reinterpret_cast<QGraphicsItem*>(_scene.addPixmap(img01));
          }

          {
          QImageReader reader2(file);
          reader2.setClipRect(QRect(0, 0, halfWidth, halfHeight));
          QPixmap img02 = QPixmap::fromImage(reader2.read());
          QGraphicsItem* itemHolder = reinterpret_cast<QGraphicsItem*>(_scene.addPixmap(img02));
          }

          {
          QImageReader reader3(file);
          reader3.setClipRect(QRect(halfWidth, halfHeight, halfWidth, halfHeight));
          QPixmap img03 = QPixmap::fromImage(reader3.read());
          QGraphicsItem* itemHolder = reinterpret_cast<QGraphicsItem*>(_scene.addPixmap(img03));
          }

          {
          QImageReader reader4(file);
          reader4.setClipRect(QRect(0, halfHeight, halfWidth, halfHeight));
          QPixmap img04 = QPixmap::fromImage(reader4.read());
          QGraphicsItem* itemHolder = reinterpret_cast<QGraphicsItem*>(_scene.addPixmap(img04));
          }

          ui.graphicsView->show();@

          Just to confirm is this the correct way to split the image in chunks. I'm still pretty new to Qt :)

          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