[PyQt] Odd QImage behavior

Matt Smith melkor at orangepalantir.org
Wed Jan 28 11:55:48 GMT 2009


I am constructing QImages from numpy arrays and I use the lines:

nimage = QtGui.QImage(total.data,w,h,QtGui.QImage.Format_Indexed8)
nimage.ndarray = total
nimage.setColorTable(COLORTABLE)

If the shape of total is (h,w) this occasionally works. This will fail
if the shape of the image is an odd size like say (483,621).  It fails
by wrapping the image in a strange manner.  When I make total a
corresponding aRGB style array, (483,621,4) it works fine.  (And I don't
need the colortable).

Anyway it is working at the moment, I could repeat the problem if it is
something that needs to be fixed, or looked into.

thanks
mbs



More information about the PyQt mailing list