Limitation of Image Dimension



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


  • Moderators

    @qt27 said in Limitation of Image Dimension:

    blows up

    What do you mean by "blows up"?


  • Qt Champions 2016

    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.



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.