Reputation: 35
is it possible to read an image using Python and pyGTK and change the displayed size (i.e width=xxx height=xxx pixels)?
Sorry, about this question. It probably is very simple, but I haven't found an answer yet.
Upvotes: 1
Views: 456
Reputation: 7150
width = xxx
height = xxx
im = gtk.Image()
pixbuf = gtk.gdk.pixbuf_new_from_file("my.jpg") # Your image file
scaled_buf = pixbuf.scale_simple(width, height, gtk.gdk.INTERP_BILINEAR)
im.set_from_pixbuf(scaled_buf)
im.show()
For more informations about the last argument of scale_simple
, see interp_type.
Reference : PyGTK FAQ
Upvotes: 3