GNOME Bugzilla – Bug 118839
Pixbuf.pixal_array attribute created incorrectly
Last modified: 2004-12-22 21:47:04 UTC
The creation of the Numeric array for the Pixbuf.pixal_array attribute has the width and height transposed in the dimensions array. For example: >>> # create a width=1, height=4 pixel, without alpha >>> p = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, 1, 4) >>> p.fill(0) >>> # get the first row >>> p.pixel_array[0] array([[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 7]], 'b') That result should have been: array([[0, 0, 0]], 'b') In some situation this can even cause a segfault, as the rowstride gets used the wrong number of times and you go off the end of the pixels array. I will attach a patch.
Created attachment 18805 [details] [review] patch against pygtk-1.99.16 that fixes this bug (should still be valid for 1.99.17)
To clarify, this bug is also in the lastest CVS version.
Fixed in CVS. Thanks.