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. Limitation of Image Dimension

Limitation of Image Dimension

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 837 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.
  • qt27Q Offline
    qt27Q Offline
    qt27
    wrote on last edited by
    #1

    Is there some limitation of image dimensions? I have the following code:

    m_pImage = new QImage(m_pcData, nWidth, nHeight, QImage::Format_Grayscale8);
    pixmap = QPixmap::fromImage(*m_pImage);

    Each time I try to load an image where the width is not a multiple of 4 fromImage blows up.

    jsulmJ kshegunovK 2 Replies Last reply
    0
    • qt27Q qt27

      Is there some limitation of image dimensions? I have the following code:

      m_pImage = new QImage(m_pcData, nWidth, nHeight, QImage::Format_Grayscale8);
      pixmap = QPixmap::fromImage(*m_pImage);

      Each time I try to load an image where the width is not a multiple of 4 fromImage blows up.

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

      @qt27 said in Limitation of Image Dimension:

      blows up

      What do you mean by "blows up"?

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

      1 Reply Last reply
      1
      • qt27Q qt27

        Is there some limitation of image dimensions? I have the following code:

        m_pImage = new QImage(m_pcData, nWidth, nHeight, QImage::Format_Grayscale8);
        pixmap = QPixmap::fromImage(*m_pImage);

        Each time I try to load an image where the width is not a multiple of 4 fromImage blows up.

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by
        #3

        There is a limitation but it has nothing to do with your code.

        Here it is clearly stated:

        Constructs an image with the given width, height and format, that uses an existing read-only memory buffer, data. The width and height must be specified in pixels, data must be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned.

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        2
        • qt27Q Offline
          qt27Q Offline
          qt27
          wrote on last edited by
          #4

          Ah, thanks kshegunov. I looked into the documentation of QPixmap because that one threw an exception.

          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