Search code examples
pythongtkraspberry-pi3raspbianpygobject

PygObject and INTERP_BILINEAR


I'm working on a little project on a Raspberry Pi, and playing with PygObject for the first time.

I'm trying to scale an image, and every example I find says I need to use a flag named INTERP_BILINEAR, but I can't find that anywhere within PygObject/Gtk. I've grep'ed the code base and can't seem to find any reference to INTERP_BILINEAR. I'm sure I'm missing something really obvious, but I don't know what.

pixbuf = GdkPixbuf.Pixbuf.new_from_file(random.choice(pics))
pixbuf = pixbuf.scale_simple(100, 100, <some_package>.INTERP_BILINEAR)

img = Gtk.image_new_from_pixbuf(pixbuf)

Solution

  • INTERP_BILINEAR is GdkPixbuf.InterpType.BILINEAR. I searched for INTERP_BILINEAR in the results of calling help("GdkPixbuf"). Often, Gtk and related modules use this type of formatting when referencing their objects.