Package: python2.3-gtk2
Version: 2.4.1-2
Severity: normal
A Numeric array generated by gtk.gdk.Pixbuf.get_pixels_array does not
appear to be resizable correctly. Arrays generated using only 'Numeric'
appear to work correctly, so I think it is a python2.3-gtk2 bug.
Here is an example script:
## CUT ##
from Numeric import *
import pygtk
from gtk import *
a = gdk.pixbuf_new_from_file("white.xpm").get_pixels_array()
print "a.shape=",a.shape
print "a[1,0]=",a[1,0]
(h,w,three) = a.shape
a.shape = (-1,3)
print "After reshaping, a.shape=",a.shape
a.shape = (h,w,3)
print "After unreshaping:"
print "a.shape=",a.shape
print "a[1,0]=",a[1,0]
## CUT ##
"white.xpm" is an all white XPM:
#CUT#
/* XPM */
static char *white[] = {
/* width height num_colors chars_per_pixel */
" 142 77 1 1",
/* colors */
". c #ffffff",
/* pixels */
<trunctated>
#CUT#
The output of this script is:
#CUT#
a.shape= (155, 285, 3)
a[1,0]= [255 255 255]
After reshaping, a.shape= (44175, 3)
After unreshaping:
a.shape= (155, 285, 3)
a[1,0]= [ 0 255 255]
#CUT#
Note that after shaping it to be (essentially) a single row of pixels
and then back again, there's garbage in the first column. This
does not appear to occur with a sufficiently small XPM (it doesn't seem
wrong in a white XPM that is 100x50, for example).
-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.4.28-seekdir
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Versions of packages python2.3-gtk2 depends on:
ii libatk1.0-0 1.8.0-4 The ATK accessibility toolkit
ii libc6 2.3.2.ds1-20 GNU C Library: Shared libraries an
ii libglib2.0-0 2.6.2-1 The GLib library of C routines
ii libgtk2.0-0 2.4.14-2 The GTK+ graphical user interface
ii libpango1.0-0 1.8.0-3 Layout and rendering of internatio
ii python2.3 2.3.5-1 An interactive high-level object-o
ii python2.3-numeric 23.7-2 Numerical (matrix-oriented) Mathem
-- debconf-show failed
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]