[Qt-interest] QImage bytesPerLine != width()*depth()/8 Why?

MARTIN Pierre hickscorp at gmail.com
Wed Sep 21 00:31:33 CEST 2011


Hello,

i'm wondering... i am developing around a private API which requires me to pass it grayscale image data. i am supposed to pass it a uchar ptr, a width and a height. When doing so, the private API sees an erroneous picture... After a bit of investigation, i figured out that for instance:
qDebug() << img.bytesPerLine() << img.size() << img.depth();
i'm getting:
1380 QSize(1377, 634)  8
This is clearly why the private API can't access the picture correctly, an offset is created after reading each line, because instead of reading a line and then another, it reads a line then something undefined and so on.
i really don't understand this. Can someone please explain?

Thanks,
Pierre.




More information about the Qt-interest-old mailing list