How to use GDK with Quickly
Solution 1:
Try importing it like this:
from gi.repository import Gtk
from gi.repository.GdkPixbuf import Pixbuf, InterpType
then:
pixbuf = Pixbuf.new_from_file(filename)
pixbuf = pixbuf.scale_simple(100, 100, InterpType.BILINEAR)
I would recommend using the command below because it automatically scales it when it reads it in. Just specify how big (pixels) you want the image to be:
pixbuf = Pixbuf.new_from_file_at_size(size_x, size_y, filename)
- Using scale_simple() does not preserve aspect ratio.
- Using new_from_file_at_size() preserves aspect ratio