After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 118839 - Pixbuf.pixal_array attribute created incorrectly
Pixbuf.pixal_array attribute created incorrectly
Status: RESOLVED FIXED
Product: pygtk
Classification: Bindings
Component: general
1.99.x/2.0.x
Other All
: Normal normal
: ---
Assigned To: Python bindings maintainers
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2003-08-01 05:00 UTC by Tim Evans
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch against pygtk-1.99.16 that fixes this bug (should still be valid for 1.99.17) (490 bytes, patch)
2003-08-01 05:00 UTC, Tim Evans
none Details | Review

Description Tim Evans 2003-08-01 05:00:12 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.
Comment 1 Tim Evans 2003-08-01 05:00:52 UTC
Created attachment 18805 [details] [review]
patch against pygtk-1.99.16 that fixes this bug (should still be valid for 1.99.17)
Comment 2 Tim Evans 2003-08-01 05:02:12 UTC
To clarify, this bug is also in the lastest CVS version.
Comment 3 James Henstridge 2003-08-02 14:41:55 UTC
Fixed in CVS.  Thanks.